Gofer01
  •  Gofer01
  • 100% (Exalted)
  • YAF Commander Topic Starter
2011-10-21T08:00:38Z
I getting this error


Server Error in '/' Application.

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.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.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.

Source Error: 


[No relevant source lines]

Source File: App_Web_0644y3bc.0.cs    Line: 0 

Stack Trace: 


[ViewStateException: Invalid viewstate. 
	Client IP: 174.28.100.188
	Port: 59005
	User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.202 Safari/535.1
	ViewState: /wEPDwUKLTMzMTkwNzA4OQ9kFgICBQ9kFgICAw9kFgYCAQ9kFggCAw8PFgIeB1Zpc2libGVnZBYGAgEPDxYGHgdUb29sVGlwBQpNeSBQcm9maWxlHgtOYXZpZ2F0ZVVybAUUL3lhZl9jcF9wcm9maWxlLmFzcHgeBFRleHQFCk15IFByb2ZpbGVkZAIJDw8WBh8BBQlNeSBUb3BpY3MfAgUSL3lhZl9teXRvcGljcy5hc3B4HwMFCU15IFRvcGljc2RkAgsPFgIfAGcWAgIBDw8WBB8DBQZMb2dvdXQfAQUGTG9nb3V0ZGQCBQ8PFgIfAGdkZAIJDw8WAh8AZ2QWBAIBDw9kFgYeCW9ua2V5ZG93bgW1AWlmKGV2ZW50LndoaWNoIHx8IGV2ZW50LmtleUNvZGUpe2lmICgoZXZlbnQud2hpY2ggPT0gMTMpIHx8IChldmVudC5rZXlDb2RlID09IDEzKSkge2RvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdmb3J1bV9jdGwwMV9kb1F1aWNrU2VhcmNoJykuY2xpY2soKTtyZXR1cm4gZmFsc2U7fX0gZWxzZSB7cmV0dXJuIHRydWV9OyAeB29uZm9jdXMFOWlmICh0aGlzLnZhbHVlID09ICdTZWFyY2ggS2V5d29yZC4uLicpIHt0aGlzLnZhbHVlID0gJyc7fR4Gb25ibHVyBTlpZiAodGhpcy52YWx1ZSA9PSAnJykge3RoaXMudmFsdWUgPSAnU2VhcmNoIEtleXdvcmQuLi4nO31kAgMPDxYCHwMFUDxpbWcgYWx0PSJTZWFyY2giIHRpdGxlPSJTZWFy...]

[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) +237
   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.default_aspx.ProcessRequest(HttpContext context) in App_Web_0644y3bc.0.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420 

I have no clue on how to resolve this error. I can be anywhere in the forum and when I press the Enter key the above error comes up. Pressing F5 will not help. I have to press the back button then have to log in again.
Gofer01 attached the following image(s):

Michael
My Website 
Sponsor
bbobb
  •  bbobb
  • 100% (Exalted)
  • YAF Developer
2011-10-21T14:18:12Z
Hi.
The problem is a well known one - simply make that the error screen tells you.add the <machineKey> section.
Best, bbobb.
Gofer01
  •  Gofer01
  • 100% (Exalted)
  • YAF Commander Topic Starter
2011-10-22T05:17:40Z
Originally Posted by: bbobb 

Hi.
The problem is a well known one - simply make that the error screen tells you.add the <machineKey> section.
Best, bbobb.



I don't understand. The only thing I understood was it's a well known error. Are you saying that I have to modify the web.config file? 😕 If so can you give me an example? 😕

Thanks
Michael
My Website 
logan
  •  logan
  • 100% (Exalted)
  • YAF Leader
Gofer01
  •  Gofer01
  • 100% (Exalted)
  • YAF Commander Topic Starter
2011-10-22T09:33:06Z
Originally Posted by: logan 


Check out this post

http://forum.yetanotherf...idle-time.aspx#post41507 



Logan wrote this about a year ago.

Try adding a machine key. Sounds like your app is getting recycled 
Are there any event log errors?? ie. ViewstateMAC Failed
3-4 minutes is very low, but depends on your hosting Co.

Get a random key here: Don't use the sample below
http://www.developmentno...chinekey_generator.aspx 

That hyperlink he gave is out of date. I'm getting a 404 error clicking on the hyperlink
Gofer01 attached the following image(s):

Michael
My Website 
tha_watcha
Gofer01
  •  Gofer01
  • 100% (Exalted)
  • YAF Commander Topic Starter
2011-10-22T17:54:27Z
Thank you guy's for all of your support. 👍 Can you tell me how machine_key works?:?:
Michael
My Website 
logan
  •  logan
  • 100% (Exalted)
  • YAF Leader
2011-10-22T21:48:31Z
Gofer01
  •  Gofer01
  • 100% (Exalted)
  • YAF Commander Topic Starter
2011-10-23T00:13:43Z
Everything appears to be working. So far I'm not getting ASP.NET errors. Furthermore I understand little about Machine.config security features
Michael
My Website 
ravindu98
2021-03-16T13:53:30Z
I'm getting this error. I didn't try locally. I tried with azure. Can someone help me to fix this?
Capture.PNG

Click to View Image5 View(s)

tha_watcha
2021-03-17T03:32:38Z
Originally Posted by: ravindu98 

I'm getting this error. I didn't try locally. I tried with azure. Can someone help me to fix this?

Capture.PNG

Click to View Image5 View(s)



What error are you getting when you disable custom errors in the web.config?

UserPostedImage
ravindu98
2021-03-26T05:29:29Z
When custom errors are turned off, I get this message.

Capture.PNG

Click to View Image6 View(s)

tha_watcha
2021-03-26T14:13:32Z
You didnt turn it off correctly. You need to set it like shown in the error message...


<system.web>
   <customErrors mode="Off" />
</system.web>

UserPostedImage

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved