ASP.NET MVC AntiForgeryToken throws its exception to GET?

I have a strange error in several MVC applications that I have not noticed before; this happens in my application (in all directions), and this happened when I tried to run the latest version of Orchard (so I know that this is not only my code).

Basically the problem is that I get an exception that should be thrown when the AntiforgeryToken is not provided, but it is only expected to get it when I push the GET actions; when you first visit the page.

I tracked the behavior that occurred when I rebuild the application or relocate it. For example, I ran my site on a local IIS server, and then changed the settings for running in Cassini (obviously, rebuilding, etc. in the middle), and I got an error. The same thing when I left the Orchard website and rebuilt it (in the same VS). The same thing when I redistributed the site that I have on the Internet.

The solution I found was to clear the browser cookies, but it seems strange that you get this error when you run a GET against the endpoint, or did I miss something?

+3
source share
2 answers

, cookie . .NET , machine.config.

web.config:

<system.web>    
<machineKey validationKey="stuff" decryptionKey="stuff" validation="SHA1" decryption="AES" />

:

http://aspnetresources.com/tools/keycreator.aspx

+2
+1

Source: https://habr.com/ru/post/1751140/


All Articles