Relative Content

Tag Archive for model-view-controllerdotnetnukeantiforgerytoken

DotNetNuke C# MVC Razor Antiforgerytoken not working in DNN 9.13.03

I’m writing a C# Module for DotNetNuke 9.13 and I’m having issues with the AntiForgeryToken.
When I decorate the post method with [HttpPost] and [DotNetNuke.Web.Mvc.Framework.ActionFilters.ValidateAntiForgeryToken] I get an HTTP 401 error when I submit my form.
If I remove the [DotNetNuke.Web.Mvc.Framework.ActionFilters.ValidateAntiForgeryToken] attribute then it works.
When I check the page source BEFORE I click the submit button, I can see that the __RequestVerificationToken field inside the form, but when the form is posted, it is not present in the payload being sent (viewed using Fiddler).