gpt4 book ai didi

c# - 无效的 View 状态,Base-64 字符数组或字符串的无效长度

转载 作者:太空狗 更新时间:2023-10-29 21:44:50 33 4
gpt4 key购买 nike

我时常遇到这个错误,

ExecuteStep at line:0 at Column:0 The state information is invalid for this page and might be corrupted. (*)Invalid viewstate

内部异常:

unhandled exception in Application_Error At Load at line:0 at Column:0 Invalid length for a Base-64 char array or string

调试已启用,pdb 文件存在,如您所见,调试信息并未准确告诉我它发生的位置。

我正在使用 ASP.NET、C#、DotNet 4.5

这只发生在特定页面的加载中。

[FormatException: Invalid length for a Base-64 char array or string.]
System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength) +10545359
System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) +130
System.Convert.FromBase64String(String s) +41
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString, Purpose purpose) +66
System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter2.Deserialize(String serializedState, Purpose purpose) +8
System.Web.UI.Util.DeserializeWithAssert(IStateFormatter2 formatter, String serializedState, Purpose purpose) +40
System.Web.UI.HiddenFieldPageStatePersister.Load() +127

[ViewStateException: Invalid viewstate.
Client IP: ::1
Port:
Referer: http://localhost:8000/ERP/MemberArea/Permits/Process_New.aspx
Path: /ERP/MemberArea/Permits/Process_New.aspx
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
ViewState: gIPYryxr+zwvGD5IdEv+hEYGPlEzkjxJDqtmnwmHt1TAjkdQ7AnFxm4v+85SO51MA3b+XRxf66nzwA8s8PqtrkQ8HdesiWnhkFp84+2ojOaAPw0+9FEw88EtB+2DH2Am7tv1qxS+WORKR0CducWqvJ65X7Q2iJH0yDwxCrNIOxIH/xgur3macyaqxYhZD99Jr+yrwiHY6q8v/IkdR41gz8UoGkU/J+5RB//I1RQZ8HAXLJhnEG4c5ZfJ0OD5kyyLI23S4JRaOR6vQT95nAdoxqSzsOLdiyYWPfrCyTk1gm8cPNLYzy1wC3JQ5I5446M/Y+2JjH1qde/0fhlKdsng4InIPOSFtWCckTe8aZBNFQvCd3fJdAByQvMVSXoRi9xNO3Ulwyd2nn/z0b5/ST/o+6TysKZ7Yeb/UPdnw5tXH9va0opHDZex289ZTaS7kpFWZaiXNbVbGNwBtRAtjqJXQb4+/C3pO6EWQh+snv929LyM52eDA+3F+6CZuFKSJo4naJL+lSL0A/sBMXC2tHEf3DPEAvbVSFb8nuYcpVJxddJkIw49GJ7BmwHk8gL9sON4ZaQdDmXe7HHGWFNdsfiZ2fB/HfTE/U/a6qmlOcciVAui+qTzxri1iGFhSa4QhkcgstPF5O6CLPYASsnCfmvBrIdQVB02j1yg2hqthtz5Z7gdKwqpr5qBmYI2q1W9OjTPf2LJjJExOmBm8/9DAY7hDt4VBJH9/WRQNz9TQh2ktn2tsZvyGBLvalyhHoGMpH...]

[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) +198
System.Web.UI.HiddenFieldPageStatePersister.Load() +266
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +88
System.Web.UI.Page.LoadAllState() +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6704
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245
System.Web.UI.Page.ProcessRequest() +72
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +58
ASP.memberarea_permits_process_new_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\ERP\5da93c6f\27d5fbc5\App_Web_llo4zgw1.4.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

最佳答案

所有学分归功于@Aristos 对另一个问题的回答: Click here

他提供了三种可能性,我的问题是页面重新加载三次导致 View 状态损坏。

我有一个自定义的 JQuery 日期选择器,并且有一个调用 OnvalueChanged 事件的 javascript 代码,我正在比较两个相同但格式不同的日期值,这导致事件以某种方式多次触发。

要对此进行调试,请在 Page_Load 事件上放置一个断点,如果它被多次触发,则开始删除一些代码/用户控件、脚本,直到找到原因。

关于c# - 无效的 View 状态,Base-64 字符数组或字符串的无效长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20930855/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com