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

Topics: General, Troubleshooting, Writing modules
Aug 30, 2011 at 1:48 PM

I have a driver which returns a view with a form  Html.BeginFormAntiForgeryPost.....

I placed the following in the web.config:

<machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="SHA1" decryption="Auto" />

When i hit the submit button i get the following error:

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

I'm posting to a controller action:

[Themed(false)]
[HttpPost]
[ValidateAntiForgeryToken]
public ViewResult Edit(string returnUrl)



Aug 31, 2011 at 7:33 AM

nevermind. i fixed it by using the following:

[HttpPost]
[Authorize]
[SuppressMessage("Microsoft.Design", "CA1054:UriParametersShouldNotBeStrings", Justification = "Needs to take same parameter type as Controller.Redirect()")]