Validation of viewstate MAC failed
i am getting this exception help me how to solve this problem.
Error Time : 20091104 151412
Error Message : 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.
Source : System.Web
StackTrace : at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState)
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()
at System.Web.UI.Page.LoadPageStateFromPersistenceMedium()
at System.Web.UI.Page.LoadAllState()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.bla_bls_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\87932190\f6393965\App_Web_slwxkxn3.2.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Target Site : Void ThrowError(System.Exception, System.String, System.String, Boolean)
Inner Exception : System.Web.UI.ViewStateException: Invalid viewstate.
Client IP: 172.16.153.71
Port: 1466
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 2.0.50727)
ViewState: /wEPDwUKLTg3MDIzOTc1Ng9kFgICAw9kFgICAw9kFgJmD2QWBgIdD2QWAgIBDzwrAA0BAA8WBB4LXyFEYXRhQm91bmRnHgtfIUl0ZW1Db3VudAIUZBYCZg9kFioCAQ9kFhpmDw8WAh4EVGV4dAUDODU4ZGQCAQ8PFgIfAgUKMSAgICAgICAgIGRkAgIPDxYCHwIFDE5ZS1UgNjEwOTc1MGRkAgMPDxYCHwIFAzQwJ2RkAgQPDxYCHwIFA05ZS2RkAgUPDxYCHwIFClgtUHJlc3MgMjFkZAIGDw8WAh8CBRQzMC开发者_如何转开发BPY3QgMjAwOSAwNDowMDowMGRkAgcPDxYCHwIFB1RFTEZPUkRkZAIIDw8WAh8CBQJJS2RkAgkPDxYCHwIFAkZHZGQCCg8PFgQeCUJhY2tDb2xvcgqmAR4EXyFTQgIIZBYCAgEPDxYCHwIFCkluIFByb2Nlc3NkZAILDw8WBB8DCqcBHwQCCGQWAgIBDw8WAh8CBRQwNCBOb3YgMjAwOSAxMTowMDowMGRkAgwPZBYCAgEPDxYCHwIFBkV4ZmFjdGRkAgIPZBYaZg8PFgIfAgUDODU1ZGQCAQ8PFgIfAgUKMiAgICAgICAgIGRkAgIPDxYCHwIFDE5ZS1UgODQ0Mzc0NWRkAgMPDxYCHwIFAzQwJ2RkAgQPDxYCHwIFA05ZS2RkAgUPDxYCHwIFClgtUHJlc3MgMjFkZAIGDw8WAh8CBRQyOSBPY3QgMjAwOSAwMzozMDowMGRkAgcPDxYCHwIFB1RFTEZPUkRkZAIIDw8WAh8CBQJJS2RkAgkPDxYCHwIFAkZHZGQCCg8PFgQfAwqmAR8EAghkFgICAQ8PFgIfAgUKSW4gUHJvY2Vzc2RkAgsPDx... ---> System.Web.HttpException: Unable to validate data.
at System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
--- End of inner exception stack trace ---
If your server is running as part of a cluster (i.e. requests to your application are balanced across multiple servers), you must ensure that your machines are all configured to use the same machine key.
ASP.NET performs validation of ViewState data when a Postback occurs. This validation uses a private key (the Machine Key) to guarantee the integrity of the data. If you don't explicitly specify this key, it is generated for you. Different machines will generate different keys, and thus load-balanced requests may fail validation because they are validating against different keys depending on where the page is first served from and where the Postback is sent back.
This article tells you more about the purpose of machine keys as well as how to configure your servers.
You need to have the same validation keys inside your web.config on all server.
You can generate the keys with the help of this site
Please also check your IIS. In the connections section, Display Applications pools list, choose the expected pool and go to 'Recycle...' tool menu. Make sure that enough memory is allocated. To see that, watch the w3wp.exe process used amount of memory within the task manager on the machine where IIS is installed. Set up properly the Recycling manager properties. I discarded 'Virtual memory use' checkbox and prefered to plan specified hours for recycling pool application.
精彩评论