ViewUserControl Generate error "Validation of viewstate MAC failed" - by stone_fred

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


3
0
Sign in
to vote
ID 393619 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 1/9/2009 1:39:58 PM
Access Restriction Public

Description

In ASP.NET MVC beta,  When there is web form server control in ViwePage, the ViewUserControl in the page can be rendered properly. But when the server control post back, ViewUserControl will generate "Validation of viewstate MAC failed" 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: 


Line 96:             // Tracing requires Page IDs to be unique.
Line 97:             ID = Guid.NewGuid().ToString();
Line 98:             ProcessRequest(HttpContext.Current);
Line 99:         }
Line 100:
 

Source File: C:\temp\MVCBetaSource\MVC\src\SystemWebMvc\Mvc\ViewPage.cs    Line: 98 

Sign in to post a comment.
Posted by Microsoft on 8/20/2009 at 4:16 PM
Hello. Thanks for the bug report. This is by design. Server forms are not supported in ASP.NET MVC.
Posted by Mauricio Scheffer on 2/17/2009 at 8:29 AM
See http://stackoverflow.com/questions/230014/ for a discussion on this bug and possible workarounds
Posted by volatiless on 1/14/2009 at 12:36 PM
Hello. Have same exception. Reproduced when working with designer. Just remove "<form id="form1" runat="server">" and "</form>" to avoid exception.
Posted by Microsoft on 1/11/2009 at 11:00 PM
We were able to reproduce the issue you are seeing. We are escalating this issue to the product unit who works on that specific feature area. The product team will review this issue and make a decision on whether they will fix it or not for the next release.