Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3354208
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:14:40+00:00 2026-05-18T02:14:40+00:00

I have the dreaded Validation of viewstate MAC failed problem from time to time.

  • 0

I have the dreaded Validation of viewstate MAC failed problem from time to time. I run my application in a web farm and have set the machine key of the application to the same value on all web servers.
I have been doing some experiments and now I have two questions regarding the anti forgery token mechanism:

1. I seem to get this error even though I’m not calling any action with the [ValidateAntiForgeryToken] attribute (the problem seems to appear when rendering the token in the view). Why is this happening? Isn’t the validation supposed to only run when the attribute is present. The problem dissappears if the __RequestVerificationToken cookie is removed.

2. Isn’t the __RequestVerificationToken cookie supposed to be a session cookie and thus be invalid as the session expires? This doesn’t seem to be the case?

Stack trace:

A required anti-forgery token was not supplied or was invalid

at System.Web.Mvc.AntiForgeryDataSerializer.Deserialize(String
serializedToken)
at
System.Web.Mvc.HtmlHelper.GetAntiForgeryTokenAndSetCookie(String salt,
String domain, String path)
at
System.Web.Mvc.HtmlHelper.AntiForgeryToken(String salt, String domain,
String path)
at System.Web.Mvc.HtmlHelper.AntiForgeryToken()

at
ASP.views_customer__customerlogin_ascx.__Render__control1(HtmlTextWriter
__w, Control parameterContainer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children)
at
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children)
at
System.Web.UI.Page.Render(HtmlTextWriter writer)
at
System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

at System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequest(HttpContext context)
at
System.Web.Mvc.ViewUserControl.ViewUserControlContainerPage.ProcessRequest(HttpContext
context)
at System.Web.Mvc.ViewPage.RenderView(ViewContext
viewContext)
at
System.Web.Mvc.ViewUserControl.RenderViewAndRestoreContentType(ViewPage
containerPage, ViewContext viewContext)
at
System.Web.Mvc.HtmlHelper.RenderPartialInternal(String
partialViewName, ViewDataDictionary viewData, Object model, TextWriter
writer, ViewEngineCollection viewEngineCollection)
at
System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper
htmlHelper, String partialViewName, Object model) at
ASP.views_cart_index_aspx.__Rendercontainer_main(HtmlTextWriter __w,
Control parameterContainer)
at
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) at
ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w,
Control parameterContainer) at
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children)
at
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer,
ICollection children) at System.Web.UI.Page.Render(HtmlTextWriter
writer)
at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequest(HttpContext context)
at
System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context) at
ASP.views_cart_index_aspx.ProcessRequest(HttpContext context)
at
System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass1.b__0()
at
System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.b__3()

at
System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1
func)
at
System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap(Action
action)
at
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler,
TextWriter writer, Boolean preserveForm, Boolean setPreviousPage,
VirtualPath path, VirtualPath filePath, String physPath, Exception
error, String queryStringOverride)

Inner exception

Validation of viewstate MAC failed. If this application is hosted by a
Web Farm or cluster, ensure that configuration specifies
the same validationKey and validation algorithm. AutoGenerate cannot
be used in a cluster.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:14:41+00:00Added an answer on May 18, 2026 at 2:14 am
    1. Only actions decorated with the [ValidateAntiForgeryToken] attribute verify the token and may raise this exception.
    2. __RequestVerificationToken cookie has no relation to any session and never times out. The verification consists of checking the equality of the cookie value with the POSTed value from the hidden field.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.