Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cl


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cl

  1. #1
    Join Date
    Mar 2006
    Posts
    24

    Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cl

    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.

    The above message is what I get in my ASP.NET 2.0 page. I have debugging turned on and for those who want to see the stack trace, see below.

    In my old web site I had a frame set with a ASP page in left frame and ASP.NET 2.0 page in right frame. It was working perfectly.

    Then I changed the frame set into IFRAMEs (well actually using floating/draggable/resizable IFRAMEs from http://blogus.xilinus.com/ ). Now I get the above error message when I try to load up my ASP.NET 2.0 page within a IFRAME created by http://blogus.xilinus.com/. ASP pages are fine.




    Stack Trace:
    [CryptographicException: Length of the data to decrypt is invalid.]
    System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) +1493410
    System.Security.Cryptography.CryptoStream.FlushFinalBlock() +30
    System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo) +154
    System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +119
    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +214

    [ViewStateException: Invalid viewstate.
    Client IP: 127.0.0.1
    Port: 4945
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
    ViewState: /wEPDwULLTEyMTQ2MDU5NjVkZLmM+Cz37HbivYCM/Wp5kXC0U+qx
    Referer: http://localhost/main.aspx
    Path: /Record/Optimiser/ASP/OptimiserOpen.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) +116
    System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +251
    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() +220
    System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +83
    System.Web.UI.Page.LoadAllState() +35
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6953
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +154
    System.Web.UI.Page.ProcessRequest() +86
    System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    ASP.record_optimiser_asp_optimiseropen_aspx.ProcessRequest(HttpContext context) +29
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    The fact that it works with ASP is irrelevant; ASP has no concept of viewstate. Have you tried implementing the fix suggested in the error message: "Ensure that <machineKey> configuration specifies the same validationKey and validation algorithm"?
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jun 2006
    Posts
    1
    <%@ Page EnableViewStateMac="false" %>

    Did wonders for me

Similar Threads

  1. Replies: 2
    Last Post: 03-31-2009, 02:11 PM
  2. Replies: 0
    Last Post: 04-21-2006, 01:04 AM
  3. Replies: 0
    Last Post: 10-03-2002, 08:05 PM
  4. Web services
    By madhavi pathi in forum .NET
    Replies: 4
    Last Post: 09-03-2002, 12:49 PM
  5. Replies: 0
    Last Post: 08-29-2002, 09:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center