0

重複の可能性:
ポストバック中の「オブジェクトの現在の状態のため、操作は有効ではありません」エラー

[InvalidOperationException: Operation is not valid due to the current state of the object.]
   System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2420862
   System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding) +58
   System.Web.HttpRequest.FillInFormCollection() +159

[HttpException (0x80004005): The URL-encoded form data is not valid.]
   System.Web.HttpRequest.FillInFormCollection() +217
   System.Web.HttpRequest.get_Form() +104
   System.Web.HttpRequest.get_HasForm() +9038959
   System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +97
   System.Web.UI.Page.DeterminePostBackMode() +69
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +135

このエラーが何度も発生する

私のコードビハインド!! キャンセル ボタンは DATAGRID 内にあります

if (((System.Web.UI.WebControls.Button)e.CommandSource).CommandName == "Cancel")
    {
        string value = (e.Item.FindControl("txtStatDesc") as System.Web.UI.WebControls.Label).Text;

        if (value.Equals("Sent", StringComparison.CurrentCultureIgnoreCase))
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('You can not cancel the dta because it is in sent mode. Cancellation refused');", true);

        }


       else if (value.Equals("Prepared", StringComparison.CurrentCultureIgnoreCase))
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('DEF');", true);

       else
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('xyz');", true);



    }
4

1 に答える 1

2

フォームに1000を超えるデータ要素がある場合にのみエラーが発生するため、データグリッドが問題を引き起こしていると推測しています。この制限は、サービス拒否攻撃に対処するためにMicrosoftによって2011年に追加されました。

制限の詳細と、必要に応じて制限を引き上げる方法については、こちらをご覧ください

于 2012-10-06T21:22:06.670 に答える