2011-07-04 100 views
0

有人可以幫我解決這個錯誤。它通常發生在應用程序空閒或會話過期時。視圖狀態MAC驗證失敗

謝謝

HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.] 
    System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106 
    System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +14 
    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +242 
    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() +207 
    System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105 
    System.Web.UI.Page.LoadAllState() +43 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 
    System.Web.UI.Page.ProcessRequest() +80 
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49 
    ASP.accounting_obracun_search_aspx.ProcessRequest(HttpContext context) +4 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 

回答

2

在你的web.config下,只需添加的EnableViewState = 「假」,就是這樣。你永遠不會再看到這個錯誤。

+0

會影響每個.aspx頁面上的控件的視圖狀態嗎? – mko

+0

是......!如果您想爲單個頁面創建頁面,請在.aspx頁面中添加頁面enableviewstate =「false」 – lock

+0

這是因爲您的會話在20分鐘後過期。如果你離開你的頁面20分鐘,那麼你會遇到這個問題。 – lock