Testing ASP.NET Web pages will require two hidden fields (_VIEWSTATE and _EVENTVALIDATION) to be passed for subsequent requests to a web page once the hidden fields have been set in the body. This can be achieved by creating two post Processor elements of the type 'Regular Expression Extractor' and then setting the details of the Regular Expressions as follows:
[BR][BR] Response Field to Wiki Markup
Response Field to check: Body [BR]
Reference Name: VIEWSTATE
Wiki Markup |
---|
VIEWSTATE [BR] Regular Expression: id="_VIEWSTATE" value="(\[\\w/-_\].+)" [BR] |
Template: $1$
[BR] Match No. : 1 [BR]
Default Value: NOT FOUND [BR]unmigrated-wiki-markup
[BR] Response Field to check: Body [BR]
Reference Name: EVENTVALIDATION
Wiki Markup |
---|
EVENTVALIDATION [BR] Regular Expression: id="_EVENTVALIDATION" value="(\[\\w/-_\].+)" [BR] |
Template: $1$
[BR] Match No. : 1 [BR]
Default Value: NOT FOUNDFOUND
Then in order to ensure these extracted values are passed in subsequent HTTP requests, for each request specify the following to be the Send Parameters for the Request:
Name: _VIEWSTATE
Value: ${VIEWSTATE}
Name: _EVENTVALIDATION
Value: ${EVENTVALIDATION} [BR] [BR] Then in order to ensure these extracted values are passed in subsequent HTTP requests, for each request specify the following to be the Send Parameters for the Request: [BR] Name: _VIEWSTATE [BR] Value: $\{VIEWSTATE\} [BR] [BR] Name: _EVENTVALIDATION [BR] Value: $\{EVENTVALIDATION\} [BR]
Additional Note: (FrankZimper) When testing an ASP.NET 2.0 site I had to add an additional leading underscore to the id fields in the regexes. Is the number of underscores dependent on the version of ASP.NET?