Click here to Skip to main content
15,886,787 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I have hosted a site on windows azure and it is running on two instances. I am getting following error:

C#
[ViewStateException: Invalid viewstate.     Client IP: 140.237.38.11     Port: 59922         Path: /Webinars.aspx     User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) )     ViewState: /wEPDwUJODc0MTc5MzM3DxYCHgp0b3RhbENvdW50AgEWAmYPDxYCHgVjb3VudGZkFgZmD2QWCgICDxYCHgdjb250ZW50BYoBUG9zdC5CaWQuU2hpcC4gZW5hYmxlcyB0cmFuc3BvcnRhdGlvbiBwcm92aWRlcnMgdG8gY29tcGV0ZSBmb3IgYnVzaW5lc3MgYnkgYmlkZGluZyB0byBoYXVsIGxvYWRzIHBvc3RlZCBieSBzaGlwcGVycyBvZiBjb21tZXJjaWFsIGZyZWlnaHQuZAIDDxYCHwIFsgFGcmVpZ2h0LCBiaWRkaW5nLCBCaWQgb24gZnJlaWdodCwgRnJlaWdodCBxdW90ZSwgRnJlaWdodCBxdW90ZXMsIEZyZWlnaHQgcmF0ZXMsIExvYWRib2FyZCwgTG9hZCBib2FyZCwgUG9zdCBsb2FkcywgU3VwcGx5IGNoYWluLCBTdXBwbHkgY2hhaW4gbWFuYWdlbWVudCwgRnJlaWdodCBicm9rZXIsIENhcnJpZXJzZAIEDxYCHwIFDElOREVYLEZPTExPV2QCEQ8WAh4EVGV4dAXGBDwhLS0gU1RBUlQgQURNSU4gQ09ERSBCRUZPUkUgL0hFQUQgLS0+DQoNCjwhLS1TdGFydCBvZiBab3BpbSBMaXZlIENoYXQgU2NyaXB0LS0+DQo8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+DQp3aW5kb3cuJHpvcGltfHwoZnVuY3R...]

[HttpException: 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. http://go.microsoft.com/fwlink/?LinkID=314055]
at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError)
at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString)
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(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.webinars_aspx.ProcessRequest(HttpContext context) in d:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\3653c9f4\8117b1a3\App_Web_webinars.aspx.cdcab7d2.yrphmqfl.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)


have set up:

XML
<machinekey decryption="Auto" validation="SHA1" decryptionkey="AutoGenerate,IsolateApps" validationkey="AutoGenerate,IsolateApps" />

 <pages enableviewstatemac="true" controlrenderingcompatibilityversion="3.5" clientidmode="Inherit" validaterequest="false" pageparserfiltertype="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" pagebasetype="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" usercontrolbasetype="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">



But still it is giving errror of invalid viewstate.
I have read that enableViewStateMac="false" is not best practice to do that.

Can somebody helps me.

Thanks,
Amit
Posted
Updated 13-Aug-14 2:38am
v7
Comments
ZurdoDev 13-Aug-14 8:08am    
Debug your code to see what is causing it.
Kornfeld Eliyahu Peter 13-Aug-14 8:39am    
Try generate a fixed machine-key instead of AutoGenerate...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900