Welcome to the Community Exchange

Welcome to the Community Exchange, a place where community members can exchange questions and answers related to DotNetNuke. If you would like more info about the Community Exchange, please visit this page in our Wiki. 

Anti-forgery token error when accessing Site Settings on a fresh installation

DNN 6.2.3, ASP.Net 4, SQL 2008, Windows 2008R2 Server, fresh installation, Dark Knight skin.  I get the following error when trying to access Site Settings on the root portal.  Any ideas?  This is a brand new out of the box DNN installation

An error has occurred. DotNetNuke.Services.Exceptions.PageLoadException: A required anti-forgery token was not supplied or was invalid. ---> System.Web.Mvc.HttpAntiForgeryException: A required anti-forgery token was not supplied or was invalid. ---> 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. ---> System.Web.UI.ViewStateException: Invalid viewstate. Client IP: 192.168.12.42 Port: 48940 Referer: http://172.22.59.30/ Path: /Default.aspx User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_1) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1 ViewState: M8zvHPfDz3lflZAZZBn7dhwgGJdpb2WAX3ChYz3LcdFjQl2PrrpsQkenXS2xp+wZ ---> System.Security.Cryptography.CryptographicException: Bad Data. at System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr) at System.Security.Cryptography.Utils._DecryptData(SafeKeyHandle hKey, Byte[] data, Int32 ib, Int32 cb, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode PaddingMode, Boolean fDone) at System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) at System.Security.Cryptography.CryptoStream.FlushFinalBlock() at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo, Boolean useLegacyMode, IVType ivType) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidati ) at System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) at System.Web.Mvc.AntiForgeryDataSerializer.Deserialize(String serializedToken) --- End of inner exception stack trace --- 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 DotNetNuke.Framework.ServicesFrameworkImpl.RegisterAjaxAntiForgery(Page page) at DotNetNuke.Framework.PageBase.OnPreRender(EventArgs e) at DotNetNuke.Framework.DefaultPage.OnPreRender(EventArgs evt) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---

asked 9/19/2012
Steven Webster190
Steven Webster

1 Answer

This answer has been selected by the question author as the best answer.

Is this a dev or test environment?  Was there a previous DNN install using the same URL?  If so the problem is that the anti-forgery cookie set by the old site is not valid on the new site.  This can be fixed by clearing the cookies, typically closing the browser is all that is needed to clear the relevant cookie. 

answered 9/19/2012 Scott S 233
Scott S
  • Thanks - just had the same issue. - Scott McCulloch 11/9/2012

  • Yep, that was it. I forogt to clear my cookies after standing up a second installation on the same IP address. I should have known to check that - thanks for the assist! - Steven Webster 9/20/2012

Your Answer

In order to provide an answer to this question, you must Login

I am flagging this question because...




10 inform moderator flags remaining

I am deleting this question because...




I am flagging this answer because...




10 inform moderator flags remaining

Flagging a Post

You have already flagged this post. Clicking "Remove Flag" below will remove your flag, thus reducing the count by one as well.

I am deleting this answer because...




DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.