You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a setup where I apply the [AutoValidateAntiforgeryToken] attribute to a base controller class that all my other controller classes inherit from. This results in CSRF token validation occurring for all unsafe action methods in my controllers. However, I am getting the "Missing cross-site request forgery token validation" warning due to my unsafe action methods such as POST request handlers not having the [ValidateAntiForgeryToken] attribute. I have checked that the antiforgery token validation is indeed getting done.
Example:
[AutoValidateAntiforgeryToken]
public abstract class BaseController : Controller
{
...
}
public class ProjectController : BaseController
{
...
[HttpPost]
public async Task<ActionResult> SampleMethod
{
...
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I have a setup where I apply the [AutoValidateAntiforgeryToken] attribute to a base controller class that all my other controller classes inherit from. This results in CSRF token validation occurring for all unsafe action methods in my controllers. However, I am getting the "Missing cross-site request forgery token validation" warning due to my unsafe action methods such as POST request handlers not having the [ValidateAntiForgeryToken] attribute. I have checked that the antiforgery token validation is indeed getting done.
Example:
Beta Was this translation helpful? Give feedback.
All reactions