ViewStateException: Invalid viewstate loadViewstate function
-
quinta-feira, 31 de maio de 2012 09:30
I had an error with ViewState, I called the Submit function in javascript to submit a form in asp.net and set target = "_blank" in the form tag to it open a new windows when submitting.
But when submitting, the page that is opened occurs an error with viewstate.
[ViewStateException: Invalid viewstate. Client IP: Port: Referer: Path: User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19 ViewState: /wEPDwUKLTQ5MjQ3MjAzMQ9kFgJmD2QWBAIBD2QWw8WAh4HZW5jdHlwZQUTbXVsdGlwYXJ0L2Zvcm0tZGF0YRYEAgEPZBYuZg8PFgIeC05hdmlnYXRlVXJsBRdodHRwOi8vd3d3LmdpZnRhbmdvLmNvbWQWAmYPDxYEHghJbWFnZVVybAUxfi9JbWFnZXMvR2lmdGFuZ29fbG9nb19Ub3BfTGVmdF9Mb2dvX2hvcnpfdGFnLnBuZx4NQWx0ZXJuYXRlVGV4dAUIR2lmdGFuZ29kZAIBDw8WAh8ABRJQaHVvbmcgTmd1eWVuIE1pbmhkZAIDDw8WAh8ABQ4oODc3KSA0NDMtODI2NGRkAgQPDxYCHwIFG21haWx0bzpzdXBwb3J0QGdpZnRhbmdvLmNvbWRkAgUPDxYCHwIFGX4vUEFTUyUyMFVzZXIlMjBHdWlkZS5wZGZkZAIGDxYCHgdWaXNpYmxlaGQCBw8PFgIfAwUdLi4vSW1hZ2VzL1R5cGVzL2dpZnRjYXJkcy5wbmdkZAIIDw8WAh8FaGRkAgkPZBYCZg8PFgIfBWhkZAIKDw8WAh8DBTtodHRwOi8vc3RhZ2luZy53d3cuZ2lmdGFuZ28uY29tL0dQQ0dyYXBoaWNzLzAxMzE3MF9Mb2dvLmpwZ2RkAgwPZBYCAgEPDxYCHwVo...] [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.ThrowMacValidationError(Exception inner, String persistedState) +11361534 System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +11361969 System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +60 System.Web.UI.HiddenFieldPageStatePersister.Load() +11362247 System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +11442359 System.Web.UI.Page.LoadAllState() +56 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11436386 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11435902 System.Web.UI.Page.ProcessRequest() +269 System.Web.UI.Page.ProcessRequest(HttpContext context) +167 ASP.t2_cert_mycertificate_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\cert\37249763\f5a891e8\App_Web_3ivgjqvh.9.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +625 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +270
can someone tell me why it occurs this error ? and how to fix it. I tried many way to fix but it doesn't affect.
I guess the page that receives data cannot parse ViewState of some controls.
- Movido Mike Dos ZhangMicrosoft Contingent Staff quinta-feira, 7 de junho de 2012 08:12 (From:Visual C# Language)
Todas as Respostas
-
quinta-feira, 31 de maio de 2012 09:49
Please take a look
I think this is your solution
Please mark as reply if helped.
Also visit my blog http://msguy.net/ -
quinta-feira, 31 de maio de 2012 10:15
Please use the following link to troubleshoot
http://support.microsoft.com/kb/829743
With Thanks and Regards
Sambath Raj.C ;
click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you -
sexta-feira, 1 de junho de 2012 11:55
Hi,
You should be looking at forum http://forums.asp.net/
any how, Hash of the ViewState is generated based on MAC is available at machine.config, in case it is not there it takes MAC of machine, so when the post back happens, on Initialization stage checks viewstate against the same key.If it does not match throws exception that is what you are seeing.
You can look into disabling validate view state on the page level.
enableViewStateMac = false
Hope this helps you...If this post answers your question, please click "Mark As Answer". If this post is helpful please click "Mark as Helpful".
- Sugerido como Resposta NorkkMicrosoft Community Contributor sexta-feira, 1 de junho de 2012 17:28
-
quinta-feira, 7 de junho de 2012 03:49
Hi Kris444,
MSDN recommend that
This attribute should never be set to false in a production Web site.
-
quinta-feira, 7 de junho de 2012 08:10
Hi Minh,
Thank you for your post.
According to your description, your problem is related to ASP.NET, so I recommend you try ASP.NET forum: http://forums.asp.net/
Sorry for any inconvenience.
Have a nice day.
Alexander Sun [MSFT]
MSDN Community Support | Feedback to us
- Sugerido como Resposta Mr. WhartyMicrosoft Community Contributor, Moderator quinta-feira, 7 de junho de 2012 08:15