JMeter - System.Web.Mvc.HttpAntiForgeryException (0x80004005): Validation of the provided anti-forgery token failed

0

Using Blazemeter to record to login to a .Net MVC application. After recording and saving the JMX file, open the JMX file using JMeter. While running, getting the following error:

> System.Web.Mvc.HttpAntiForgeryException (0x80004005): Validation of the provided anti-forgery token failed. The cookie "__RequestVerificationToken" and the form field "__RequestVerificationToken" were swapped. at System.Web.Helpers.AntiXsrf.TokenValidator.ValidateTokens(HttpContextBase httpContext, IIdentity identity, AntiForgeryToken sessionToken, AntiForgeryToken fieldToken) at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.Validate(HttpContextBase httpContext) at System.Web.Mvc.ControllerActionInvoker.InvokeAuthorizationFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.b__19(AsyncCallback asyncCallback, Object asyncState) >

Getting stuck with it. Any help is appreciated.

Using the Regular Expression Extractor to get the __RequestVerificationToken, store in a variable and use it for logging in. This does not work.

Checked the View Results Tree. It is still showing the same message.

asp.net-mvc
jmeter
jmeter-4.0
jmeter-5.0
asked on Stack Overflow Jul 9, 2019 by Ganga Sahu • edited Jul 10, 2019 by Arif

1 Answer

0

It seems problem with the co-relation. Record two request using sniffing tools like fiddler and compare the request its header and all values. Based on comparison, identify the dynamic parameters and correlate accordingly.

The cookie "__RequestVerificationToken" and the form field "__RequestVerificationToken" were swapped.

answered on Stack Overflow Jul 10, 2019 by sunny_teo

User contributions licensed under CC BY-SA 3.0