本文介绍了国家信息是这个页面无效,可能已损坏。 (只有在IE浏览器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人可以帮助我走出这个例外。我已经试过几个补丁,但毫无效果。我得到这个例外只能在IE(7,8和9)。

当我加载页面第一次,它带来了一个下拉菜单。在这里我选择一个特定的供应商,它使一个页面后回来,并返回所需的信息。如果我改变供应商仍然会加载信息。当我加载控制到使用$阿贾克斯要求动态比回去改下拉选择页面(选择不同的供应商),它胡扯出来,给了我下面的异常。同样,它仅发生在IE浏览器。

 的状态信息是这个页面无效,可能已损坏。
说明:执行当前Web请求的执行过程中发生未处理的异常。请查看有关错误的详细信息的堆栈跟踪以及它起源于code。异常详细信息:System.Web.HttpException:国家信息是这个页面无效,可能已损坏。源错误:
[没有相关的源行]
源文件:C:\\用户\\ tmalik \\应用程序数据\\本地\\ TEMP \\临时ASP.NET文件\\ ROOT \\ 6691c708 \\ 751e6443 \\ App_Web_a3kdfsht.2.cs行:0堆栈跟踪:
[FormatException:输入不是有效的Base-64串,因为它含有非基本64字符,两个以上的填充字符,或填充字符之间的非空白字符。 ]
   System.Convert.FromBase64String(String s)将+ 0
   System.Web.UI.ObjectStateFormatter.Deserialize(字符串inputString)+77
   System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(字符串serializedState)+4
   System.Web.UI.Util.DeserializeWithAssert(IStateFormatter格式化,字符串serializedState)+37
   System.Web.UI.HiddenFieldPageStatePersister.Load()+147[ViewStateException:无效的视图状态。
    客户端IP:127.0.0.1
    港口:
    引用者:HTTP://本地主机:57289 / vendor.aspx
    路径:/vendor.aspx
    用户代理:Mozilla的/ 4.0(兼容; MSIE 7.0; Windows NT的6.1; WOW64;三叉戟/ 5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729;媒体中心PC 6.0 ; .NET4.0C; .NET4.0E; MDDR)
    ViewState的: 2D1IMRanPXfVARbRp1ooiwD71WHybNzxSNLbbA0G3MxKeo7m52dHWLBPGdnMH5JthTnPVt7UES/PVx39dfZYHbr0/DL7J58mvA2I4wRUSdDShVxvZqC7ZPZWcatowpZ7VYaD9PFKW7OkgppCwmePFuYnpU8kWDT5TvSLqN50Flrqpv0zCM9YoCKemfesa68rqBkkSTijcxnxdDCgvzSl72giI4ZhwK92wD22Ma6scW4PFjRZeTsKoowJq+JqJGuBMEepwKguFUy4dX86UIULnJ7NQsgZW1aQvpZdnfSRCSYrWhFWPhKTPsS622eaQYShsxddPs/mfEB26f54WS+iBYuk3mWm8jr6sWvsOIRtwH8b3E/5UujbgAxTNVg8BhzpSFvmE4KwGKo0tKuuqOFtP0pjpaAI7fV3EQ1M7BVQSAVrtBevRFJ0PlCPrU2aQms2LVeE5POqTJGtY+74xWkdCtLzT04Ug4R+SMBRElQBqX/5A54OHj2ghYjJ/3tgg4ToGUX2xrQ/c70lrphP+kabGVM2Op4DFjZAaOZj/CDVUurH2BYXKuJdUvzbf2zHngoOnqZGqrw3n6V6HGcnHNKxfuGQ20MPdxJYCbYHGiRqixzV1NxJoHFHbYCVx3IlrqF0W44AFKm2gzzk3V8zu9lUjyFNvUNBMjNaZeekLtcWpszhKrm8WhVnWQAk1CXxKJqyK0RC3...][HttpException(0x80004005的):国家信息是这个页面无效,可能已损坏。]
   System.Web.UI.ViewStateException.ThrowError(例外内,字符串persistedState,字符串errorPageMes​​sage,布尔macValidationError)+235
   System.Web.UI.ViewStateException.ThrowViewStateError(例外内,弦乐persistedState)+14
   System.Web.UI.HiddenFieldPageStatePersister.Load()+251
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium()+106
   System.Web.UI.Page.LoadAllState()+43
   System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)8431
   System.Web.UI.Page.ProcessRequest(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+253
   System.Web.UI.Page.ProcessRequest()+78
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext的背景下)+21
   System.Web.UI.Page.ProcessRequest(HttpContext的背景下)+49
   ASP.vendor_aspx.ProcessRequest(HttpContext的背景下)在C:\\用户\\ tmalik \\应用程序数据\\本地\\ TEMP \\临时ASP.NET文件\\ ROOT \\ 6691c708 \\ 751e6443 \\ App_Web_a3kdfsht.2.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep一步,布尔和放大器; completedSynchronously)+75


解决方案

好了,所以这里是解决/劈我想出了。我的问题是,添加用户控件动态(通过Ajax请求)到网页被更改页面的视图状态,并抛出异常。经研究,我发现,ViewState的存储页面(属性和设置)的状态。一旦你从一个web服务返回的HTML控件,有将是某种形式的视图状态保存到页面。而当你回发到服务器时,它会何时解密viewstae重建页面抛出异常。我只是删除了这些控制在页面回发(这得到了动态添加)使用jQuery和问题得到有效解决。

  //我的情况VendorListDropDownSearchable,导致页面回发。
    $(#VendorListDropDownSearchable)。改变(函数(){
        $(#UserControl1DIV),删除()。 //除去地方夹具夹持CONTROL1
        $(#UserControl2DIV),删除()。 //与上述相同
    });

Can anybody help me out with this exception. I have tried couple of fixes but nothing worked. I am getting this exception only in IE(7, 8 and 9).

When i load the page first time, it brings up a dropdown. where i select a specific vendor and it makes a page post back and returns the required information. If i change the vendor it will still load the information. When i load a control onto page using $.ajax request dynamically and than go back and change the dropdown selection(select a different vendor), it craps out and gave me the following exception. Again it only happens in the IE.

The state information is invalid for this page and might be corrupted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted.

Source Error:


[No relevant source lines]


Source File: c:\Users\tmalik\AppData\Local\Temp\Temporary ASP.NET Files\root\6691c708\751e6443\App_Web_a3kdfsht.2.cs    Line: 0

Stack Trace:


[FormatException: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters. ]
   System.Convert.FromBase64String(String s) +0
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +77
   System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
   System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
   System.Web.UI.HiddenFieldPageStatePersister.Load() +147

[ViewStateException: Invalid viewstate.
    Client IP: 127.0.0.1
    Port:
    Referer: http://localhost:57289/vendor.aspx
    Path: /vendor.aspx
    User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MDDR)
    ViewState: 2D1IMRanPXfVARbRp1ooiwD71WHybNzxSNLbbA0G3MxKeo7m52dHWLBPGdnMH5JthTnPVt7UES/PVx39dfZYHbr0/DL7J58mvA2I4wRUSdDShVxvZqC7ZPZWcatowpZ7VYaD9PFKW7OkgppCwmePFuYnpU8kWDT5TvSLqN50Flrqpv0zCM9YoCKemfesa68rqBkkSTijcxnxdDCgvzSl72giI4ZhwK92wD22Ma6scW4PFjRZeTsKoowJq+JqJGuBMEepwKguFUy4dX86UIULnJ7NQsgZW1aQvpZdnfSRCSYrWhFWPhKTPsS622eaQYShsxddPs/mfEB26f54WS+iBYuk3mWm8jr6sWvsOIRtwH8b3E/5UujbgAxTNVg8BhzpSFvmE4KwGKo0tKuuqOFtP0pjpaAI7fV3EQ1M7BVQSAVrtBevRFJ0PlCPrU2aQms2LVeE5POqTJGtY+74xWkdCtLzT04Ug4R+SMBRElQBqX/5A54OHj2ghYjJ/3tgg4ToGUX2xrQ/c70lrphP+kabGVM2Op4DFjZAaOZj/CDVUurH2BYXKuJdUvzbf2zHngoOnqZGqrw3n6V6HGcnHNKxfuGQ20MPdxJYCbYHGiRqixzV1NxJoHFHbYCVx3IlrqF0W44AFKm2gzzk3V8zu9lUjyFNvUNBMjNaZeekLtcWpszhKrm8WhVnWQAk1CXxKJqyK0RC3...]

[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.]
   System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +235
   System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState) +14
   System.Web.UI.HiddenFieldPageStatePersister.Load() +251
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +106
   System.Web.UI.Page.LoadAllState() +43
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8431
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +253
   System.Web.UI.Page.ProcessRequest() +78
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.vendor_aspx.ProcessRequest(HttpContext context) in c:\Users\tmalik\AppData\Local\Temp\Temporary ASP.NET Files\root\6691c708\751e6443\App_Web_a3kdfsht.2.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
解决方案

Ok, so here is the solution/hack i came up with. My problem was that adding a user control dynamically (through ajax request) onto page was changing the view state of the page and was throwing an exception. Upon research I found out that viewstate stores the state of a page (properties and settings). Once you return the controls html from a web service, there is going to be some sort of viewstate stored onto page. And when you post back to the server, it will throw an exception when it decrypt the viewstae to rebuild the page. I have simply removed those controls (which got added dynamically) on page post back using jquery and problem got solved.

//In my case "VendorListDropDownSearchable", causes the page post back.
    $("#VendorListDropDownSearchable").change( function () {
        $("#UserControl1DIV").remove(); //removing the place holder holding control1
        $("#UserControl2DIV").remove(); //same as above
    });

这篇关于国家信息是这个页面无效,可能已损坏。 (只有在IE浏览器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 20:34