I have recorded ‘Login’ in jmeter. My Application uses ‘CSRF’ token.
So I added regular expression extractor as in the screen shot.
I have tried different types of patterns:
"<input name="__RequestVerificationToken" type="hidden" value="([A-Za-z0-9+=/-_]+)">"
"<input name="__RequestVerificationToken" type="hidden" value="(.+?)" />". etc
But, When I check the response it is like ‘__RequestVerificationToken=%24%7Btoken%7D’
I tried with Xpath extractor also:
‘//input[@name='__RequestVerificationToken']/@value’
I also added cookie manager
! enter image description here
! enter image description here
! enter image description here
Below screenshots are response data(having tokens) for different pages(or paths) before login
This screenshot is for the path ‘/web’(which has the token)
! enter image description here
This screenshot is for the path ‘/Web/Account/Login’ (which has different token)
! enter image description here
But the login is failing due to authentication
! enter image description here
Question :
Am I following the right method
Why there are two different token values for two different path (‘/web’ and ‘/Web/Account/Login’)
How can I resolve this issue
PS: I have read most of the articles/blogs. Still not able to resolve authentication error
You need to add the Regular Expression Extractor to the previous request to the login page, normally it should have HTTP GET method so amend your test like:
__RequestVerificationToken
)More information: ASP.NET Login Testing with JMeter