5

Bir sonuçların listesini içeren bir DataGrid veya ASP.Net Repeater listesi olarak görüntüleyen bir ASP.Net barındırılan web sitem var.ASP.Net web sitesinin HttpUnhandledException istisnasını atması, öğelerin sayfalandırılmış listesi üzerinden ileri/geri gezinirken nasıl durdurulur?

Önceki/Sonraki sekmelerine basarak sayfalarda hızlı bir şekilde gezinirseniz, bazen bir HttpUnhandledException atılır ve sonuçların sonraki listesi yerine hata ayıklama sayfası oluşturulur. aşağıdaki gibi

ayıklama ekran: Ben http://blogs.msdn.com/amitsh/archive/2007/07/31/why-i-get-invalid-postback-or-callback-argument-errors.aspx

böyle bir hata referansı bulduk ancak önerilen çözüm false ayarlamaktır

System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. 
    at System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) 
    at System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) 
    at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) 
    at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) 
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) 
    at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) 
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
    --- End of inner exception stack trace --- 
    at System.Web.UI.Page.HandleError(Exception e) 
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
    at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 
    at System.Web.UI.Page.ProcessRequest() 
    at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) 
    at System.Web.UI.Page.ProcessRequest(HttpContext context) 
    at ASP.contacts_default_aspx.ProcessRequest(HttpContext context) 
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 

, ama bu bir güvenlik oluşturmak gibi görünüyor delik. Yorumlar birkaç alternatif önermektedir, ancak hepsi sitemde kullanılan her bir DataGrid veya Repeater kontrolüne kod eklemeyi gerektirdiğinden oldukça karmaşık görünmektedir.

Güvenlikten ödün vermeden yapılabilecek daha genel bir çözüm var mı?

cevap

9

Sayfanızdaki gizli alanlar geri gönderme sırasında sağlanmıyor. Bu alanlardan bazıları vardır ve genellikle ASP.Net'in sağladığı 'büyü' için gereklidir.

Sayfa yönergelerinizde, sayfanızın yönergesini etkinleştirmek için enableEventValidation = false değerini however that may not be desirable.

You can move the write code to move the elements to the top of the page

Son olarak, bu kesin sorunu yakın zamanda hizmet paketi veya 3.5'de oldukça sabit eminim.

- DÜZENLEME - Sadece ayar bulundu

: MSDN aşağıdaki sürümleri desteklenir göre RenderAllHiddenFieldsAtTopOfForm

: 3.5 SP1, SP2 3.0, 2.0 SP2

İlgili konular