Search code examples
asp.netcsrfcsrf-protectionantiforgerytoken

How to implement antoforgery token in global.asax?


To prevent CSRF attack, its required to implement antiforgery token for asp.net website (not for MVC) in our project. We are not able to find it in google. Its better if we implement it in global.asax. Kindly help. Thanks in advance.


Solution

  • Which version of .net are you working with? Certain versions have it built into the Master page, otherwise if you need to see what it looks like in a webforms project you can check: https://software-security.sans.org/developer-how-to/developer-guide-csrf