What is the Html.AntiForgeryToken helper function for?

后端 未结 5 959
遥遥无期
遥遥无期 2021-02-05 18:51

Can somebody tell me more details about it?

5条回答
  •  梦如初夏
    2021-02-05 19:16

    Basically the anti forgery tokens stop anyone from submitting requests to your site that are generated by a malicious script not generated by the actual user. There is an HTTP only cookie (not readable by a script running in the browser, but sent by the browser and accessible by the server) that gets sent to the client, it is used to generate a hidden field value which is then validated against the cookie. At least I think that's the process.

    There is a good description of this here which is exactly what you are asking about https://blogs.msmvps.com/luisabreu/blog/2009/02/09/the-mvc-platform-the-new-anti-forgery-token/

提交回复
热议问题