ASP.NET/FireFox - 此页面的状态信息无效并且可能已损坏

发布于 2024-11-18 09:43:49 字数 2197 浏览 5 评论 0原文

我花了大约两天的时间研究这个问题,但似乎找不到解决方案,或者提供的解决方案似乎没有完全解决我遇到的问题。

  • 我有一个 ASP.NET 应用程序,.NET 4.0
  • 间歇性地,我们会收到有关视图状态损坏的错误
  • 这似乎仅适用于基于 Mozilla 的浏览器(不是 100% 确定,试图获取更多错误日志来确认)
  • 它似乎从没有一致的可重复操作。
  • 它与 MAC 不同步无关,我们显式设置了机器密钥/验证密钥,并且未设置为自动生成
  • 它仅发生在我们的生产环境中,从未发生在 DEV/QAT/UAT 中
  • 它发生在具有更新面板的页面 - 虽然某些页面确实具有非常大的视图状态,但其中一些页面具有非常小的视图状态
  • 似乎无法重新生成。我发现的一些解决方案与“单击一个页面,单击转到另一个页面的按钮,在浏览器中单击返回并发生错误”有关 - 情况并非如此。
  • Windows Enterprise 2008 上的 IIS7、16GB RAM、PAE 已启用。
  • 这些页面会正常工作一段时间,然后停止工作 - 重新启动 IIS 可以暂时解决此问题。
  • 这不是在网络农场上运行 异常/堆栈跟踪:

描述:

Error occurred System.Web.HttpException (0x80004005): The state information is invalid for this page and might be corrupted. ---> System.Web.UI.ViewStateException: Invalid viewstate.

Client IP: <removed>

Port: 21884

Referer: <removed>

Path: /PathToPage/Page.aspx

User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; MS-RTC LM 8)

ViewState: /wEPDwULLTEyNTU4MDc4NT....<removed by user>... ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

at System.Convert.FromBase64String(String s)

at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)

at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)

at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)

at System.Web.UI.HiddenFieldPageStatePersister.Load()

--- End of inner exception stack trace ---

at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)

at System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState)

at System.Web.UI.HiddenFieldPageStatePersister.Load()

at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()

at System.Web.UI.Page.LoadAllState()

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I've spent about two days looking into this issue and can't seem to find a resolution, or the ones provided don't seem to fully address the issue I am having.

  • I have an ASP.NET Application, .NET 4.0
  • Intermittently, we will get errors about View State corruption
  • This only seems to apply to Mozilla based browsers (not 100% sure, trying to get more error logs to confirm)
  • It seems to start with no consistent re-produceable action.
  • It is NOT related to MAC getting out of sync, we have our machine key / validation key explicitly set and not set to auto-generate
  • It is only happening in our Production environment, has never happened in DEV/QAT/UAT
  • It is happening on pages that have an Update Panel - while some of the pages do have a very large view-state, a few of them have a very small view-state
  • Does not seem to be re-producable. Some solutions I have found have been in relation to 'Click on a page, click on a button that goes to another page, click back in the browser and the error happens' - this is not that case.
  • IIS7 on Windows Enterprise 2008, 16GB ram, PAE is enabled.
  • The pages will work fine for awhile, and then stop working - restarting IIS solves this issue temporarily.
  • This is not running on a Web Farm
    The exception/stack trace:

Description:

Error occurred System.Web.HttpException (0x80004005): The state information is invalid for this page and might be corrupted. ---> System.Web.UI.ViewStateException: Invalid viewstate.

Client IP: <removed>

Port: 21884

Referer: <removed>

Path: /PathToPage/Page.aspx

User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; MS-RTC LM 8)

ViewState: /wEPDwULLTEyNTU4MDc4NT....<removed by user>... ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

at System.Convert.FromBase64String(String s)

at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)

at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState)

at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)

at System.Web.UI.HiddenFieldPageStatePersister.Load()

--- End of inner exception stack trace ---

at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)

at System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState)

at System.Web.UI.HiddenFieldPageStatePersister.Load()

at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()

at System.Web.UI.Page.LoadAllState()

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瘫痪情歌 2024-11-25 09:43:49

因为这个问题仅发生在更新面板页面上,所以我怀疑您在更新面板后出现了破坏视图状态的错误,并且您简单地没有捕获并且看不到此错误。

要找到它们,临时解决方案是删除更新面板以查看是否出现任何错误。

第二种解决方案是将视图状态压缩并剪切成更小的部分,以防中间的某些代理或路由器破坏它。

还有更多内容需要阅读:ASP.Net Post timeoutCryptographicException:填充无效且不能已删除且视图状态 MAC 验证失败

Because this issue happens only on update panel page, I suspect that you get error after the update panel that break the viewstate, and you simple did not catch and you can not see this errors.

To locate them a temporary solution is to remove the update panel to see if you get any errors.

Second solution is to compress and cut the view state in smaller part in case some proxy or router in the middle breaks its.

Some more to read: ASP.Net Post timeout and CryptographicException: Padding is invalid and cannot be removed and Validation of viewstate MAC failed

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文