Correct way to send AntiForgeryToken through AJAX request
I’ve been trying to send the AntiForgeryToken
through AJAX request in an ASP.NET Core MVC (area based) Razor view; however, I am definitely missing something to send in the POST
request. I read through several documentations and StackO. answers, but all of them are missing something common that I found on this MS documentation: Preventing Cross-Site Request Forgery (CSRF) Attacks in ASP.NET MVC Application. I looked at this StackO. question and the replies, and the common difference is that the MS documentation sends both the cookie and form (hidden element) token but I get an error message saying AntiForgery.GetTokens(null, out cookieToken, out formToken)
does not exist in the current context.
Security: Form vs. AJAX request in ASP.NET Core 8 MVC
I’m reviewing the subscribe page of an ASP.NET Core 8 MVC project.
Security: Form vs. AJAX request in MVC .Net 8
I’m reviewing the subscribe page of a MVC .Net 8 project.