locked
i got same error RRS feed

  • Question

  • Hi to all

    i read all your discussion. i got same error when i run my application and do any action e.g. click on any button.
    Previously my system work fine. i want to publish it. so i installed IIS, and published it and run it.
    then it throws an error as follows,

    Invalid at the top level of the document. Error processing resource 'http://localhost/CompiledSite/SamplePage.aspx'. Line ...

    This is a marker file generated by the precompilation tool, and should not be deleted!
    ^

    Error: Invalid at the top level of the document

    so i search the solution for this error is , re-register aspnet_regiis.exe with option -i

    i do that and run my system again(not published website) it runs but when i click on any button it throws error as follows,



    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) +362
       System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +218

    [ViewStateException: Invalid viewstate.
     Client IP: 127.0.0.1
     Port:
     User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
     ViewState: /wEPDwUKMTgwMjU4NzMxNWQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgIFEUxvZ2luMSRSZW1lbWJlck1lBRdMb2dpbjEkTG9naW5JbWFnZUJ1dHRvbu6Tq3rlPjk7FhgR8MOJt17h7uOp
     Referer:
    http://localhost:2425/tour%20in%20editmode/Login.aspx
     Path: /tour in editmode/Login.aspx]

    [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) +119
       System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +255
       System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +5
       System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
       System.Web.UI.HiddenFieldPageStatePersister.Load() +222
       System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +80
       System.Web.UI.Page.LoadAllState() +35
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +7992
       System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +158
       System.Web.UI.Page.ProcessRequest() +85
       System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +20
       System.Web.UI.Page.ProcessRequest(HttpContext context) +110
       ASP.login_aspx.ProcessRequest(HttpContext context) +5
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +317
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +65

     


    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42


    please help me to solve this problem..

    • Moved by Edwer Fang Friday, March 5, 2010 2:22 AM (From:Visual Studio Web Performance and Load Testing)
    Saturday, February 27, 2010 7:55 AM

Answers

  • Hello,

    I search the internet and found some similar posts you can refer to:
    http://forums.asp.net/p/955145/1173230.aspx
    http://blogs.msdn.com/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx
    http://aspadvice.com/blogs/joteke/archive/2006/02/02/15011.aspx

    As this issue is more related to ASP.NET and web site, you may post this issue on the ASP.NET Forum so you can get better and quicker response as there are more experts on this kind of issue.

    Thanks.

    This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Send us any feedback you have about the help from MSFT at fbmsdn@microsoft.com.
    • Marked as answer by Edwer Fang Friday, March 5, 2010 2:21 AM
    Monday, March 1, 2010 6:03 AM