System.Web.HttpException:无效的视图状态

问题描述:

大家好,
您能告诉我该异常的解决方案吗?


System.Web.HttpException:无效的视图状态.在System.Web.UI.Page.DecryptStringWithIV(String s,IVType ivType)在System.Web.UI.Page.DecryptString(String s)在System.Web.Handlers.ScriptResourceHandler.DecryptParameter(NameValueCollection queryString)在System.Web. System.Web.Handlers.ScriptResourceHandler.ProcessRequest(HttpContext上下文)处的Handlers.ScriptResourceHandler.ProcessRequestInternal(HttpResponse响应,NameValueCollection queryString,VirtualFileReader fileReader)在System.Web.Handlers.ScriptResourceHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext上下文) System.Web.HttpApplication.ExecuteStep处的System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()(IExecutionStep步骤,布尔值和已同步完成)

Hi All,
Can you please tell me the Solution for this exception?


System.Web.HttpException: Invalid viewstate. at System.Web.UI.Page.DecryptStringWithIV(String s, IVType ivType) at System.Web.UI.Page.DecryptString(String s) at System.Web.Handlers.ScriptResourceHandler.DecryptParameter(NameValueCollection queryString) at System.Web.Handlers.ScriptResourceHandler.ProcessRequestInternal(HttpResponse response, NameValueCollection queryString, VirtualFileReader fileReader) at System.Web.Handlers.ScriptResourceHandler.ProcessRequest(HttpContext context) at System.Web.Handlers.ScriptResourceHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

没有看到其余代码的作用,没有.但是,导致无效视图状态无效的常见原因包括:自定义控件以不一致的方式手动添加到视图状态(通常,如果存在AJAX代码,这是可见的,但是为呈现页面更新而错误实现),并且视图状态是针对Web场进行验证的, Web服务器场设置不正确,因此每台服务器上的机器密钥都不相同-导致问题,因为在验证视图状态时使用了机器密钥.
Without seeing what the rest of your code does, no. However, common causes of invalid viewstate include custom controls manually adding to viewstate in an inconsistent manner (normally this is visible if AJAX code is present, but incorrectly implemented for rendering updates to the page), and viewstate being validated against a web farm where the web farm isn''t set up properly, so the machine key is different on each server - causing problems because the machine key is used in the validation of the viewstate.