zoukankan      html  css  js  c++  java
  • "The state information is invalid for this page and might be corrupted"错误的一个解决办法

    今天收到一个bug,在FF 3.0.7上用浏览器的"后退"回到某一个页面,会出现"The state information is invalid for this page and might be corrupted"的错误,抛出信息:

    Code
    Error : The state information is invalid for this page and might be corrupted.
    Detail:   
    at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
    at System.Web.UI.ClientScriptManager.EnsureEventValidationFieldLoaded()
    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.HiddenField.LoadPostData(String postDataKey, NameValueCollection postCollection)
    at System.Web.UI.WebControls.HiddenField.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
    at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    分析应该是ViewState校验出错产生的信息,正常浏览情况下不会出现问题.因为只有用"后退"之类的操作才会出现错误.就怀疑是浏览器的缓存问题,就在Page_Load加入:

    Code
    Response.Cache.SetNoStore();

    作用是告诉浏览器不要缓存页面.在测试页面成功,不会再发生错误.

  • 相关阅读:
    基于MPI计算π值
    依赖倒转原则
    里氏代换原则
    开闭原则
    以太坊入门-solidity环境搭建
    【owner】today,last second day
    105-算法应用【N皇后问题】代码实现
    【Java小工具】节点选举Demo
    【加密算法】MD5、SHA算法加密工具类
    50-数据结构【原码、反码和补码】计算机数表示方法
  • 原文地址:https://www.cnblogs.com/KenBlove/p/1467479.html
Copyright © 2011-2022 走看看