I was doing load testing using Visual Studio 2013 Ultimate for one of the applications I was working on and I noticed the following error when I try to run the recorded load test
Context parameter ‘$HIDDEN1.__RequestVerificationToken’ not found in test context
The test scenario was the following:
- Load home page
- Click a url on a page
- Dialog shows up (GET)
- Select a value from a dropdown on the dialog (POST)
The tool was trying to use $Hidden1.__RequestVerificationToken from the main page but that variable wasn’t available in the current context.
Add a new Extraction Rule, create new variable at the GET request step above the POST request
Assigned the __RequestVerificationToken value in the form to a Context Parameter
In the Post request, change the form post parameter to new token
That specific request was a POST request done using Ajax.