[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

I get the following error message on the Browser when I run my web application: Validation of viewstate MAC failed???

Asked by salman_sulaiman_2008 in Visual Studio, WebApplications

Tags: Microsoft, Microsoft Visual Studio 2005, 2005, ASP.NET, Microsoft windows Internet Explorer 7, Validation of viewstate MAC failed

Greetings experts!
I am working on a web application, and I am using Masterpages, at a certain point when debugging the application, I get the following error on my browser (I have attached it in code snippet), and I can't figure out what goes wrong, I wish someone could help me with it.

Thanks in advance.
~salman~
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
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: 
 
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
 
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
 
  <%@ Page Language="C#" Debug="true" %>
 
or:
 
2) Add the following section to the configuration file of your application:
 
<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>
 
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
 
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.  
 
Stack Trace: 
 
 
[HttpException (0x80004005): Unable to validate data.]
   System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +294
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +203
 
[ViewStateException: Invalid viewstate. 
	Client IP: 127.0.0.1
	Port: 4609
	User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.2; .NET CLR 3.0.04506.648)
	ViewState: G3+c45mCBikArM1UQuAUAKAZnShgNMxIY0/2AiK2vsxKq2ii4mZ2dzDowvCyyLXVRnVZBTNhKKD9API1yEI5NG0B+9KviS0n1DlnT1ywdP+QxyF1X1SQeEa7MdA2hnaC2UMl/+VcbH9dL2zvVb1gaaAf+R3wAfn7aaEpQJ/R94khCle8dudzWuhCADnRNFfcGr7YyQRsbW9YmkYzGiStpZqHFWCOGWWSpXL5YmDEa6Yvav3GnbuL5pvz0hrHjLDQn+cVrlV10LGvVg7x4NcPQ/8Pby6Q+JNc3DakAJ25IRzdB8PA5sMNbmIdElvPvrJXYZcHP9HC903g0K/DPSqcBUJXEU7YBhiV7FEIKqvqibIKqwdhPketPlZqVAwMf7MYwjSZY+1fq66gNExntGcrFTCJf/KOXC76mZaOscXVz5p/YJMiWm62fXoYSIlfJ1EjpyLfYCrrzb+nsM9u/7hsR1Yp+OyQi9kpMQpqYoeBlcXiFbB2yBXWpBN5YR6Sn96yk9+uSrMpGQbEwCmrkl6o6KjUD3gqvE91IZcSKAxtqU7i7m9e+j3nFlb/QRZ/9h4gg2AC+mPOu+OZMYhvlGwXyREBqyGqdECiqtiH6l0RraSKahIz5mtUcGgeBk50wBsw/sZNirUcN/zykqy2fgq1Z8bsWpxWOc9LzAvK9JZ/Hhm3pCeRj/wtUaS3iKTEod8c0Us3dl2AsPOBV8EkNX7laPn8XgW1YcUez+yI6GXYkg29HlkUmmM6Uvu8QcYPT42sfMbIEwLUAaF4pRG6ye7ip7d5s6u9b8Yx/hjqmSjy...]
 
[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) +267
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +282
   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() +198
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
   System.Web.UI.Page.LoadAllState() +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7350
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
   System.Web.UI.Page.ProcessRequest() +86
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.budget_test_budget_availability_aspx.ProcessRequest(HttpContext context) +29
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +358
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
 
 
 
 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
[+][-]04/09/08 01:43 AM, ID: 21312875Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04/09/08 11:20 AM, ID: 21317591Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Visual Studio, WebApplications
Tags: Microsoft, Microsoft Visual Studio 2005, 2005, ASP.NET, Microsoft windows Internet Explorer 7, Validation of viewstate MAC failed
Sign Up Now!
Solution Provided By: steedBmaher
Participating Experts: 2
Solution Grade: A
 
 
Loading Advertisement...
20091021-EE-VQP-81 / EE_QW_2_20070628