Hakan san
Hakan san

Reputation: 301

Jmeter __RequestVerificationToken extracting problem

I recording login with jmeter. I test with 1 user but jmeter cannot login because of __VerificationToken.

I parsed token with CSS Selector Extractor

enter image description here

enter image description here

I'm sure the token has been moved in the cookie.

But I saw two __VerificationToken. Error return request:

GET data:
Cookie Data:
ASP.NET_SessionId=xxxxxxxxxxxxxx;
__RequestVerificationToken=hYTIRJryyxCBfF7vYlAnkPSM-JB0o-        Zp41pqFGk30cLyPAehA22k69VOU3NhY-abVbxuEZDgZHnF-bTFHf_4g1HwkuQ1; 
__RequestVerificationToken=${token}

Upvotes: 0

Views: 408

Answers (1)

Dmitri T
Dmitri T

Reputation: 168122

It's impossible to say what's wrong without seeing what parameters and headers does real browser send, however it seems you're doing something weird.

  1. You shouldn't manually create the __RequestVerificationToken cookie as it seems to be properly handled by the HTTP Cookie Manager
  2. Given you have the token value already stored in the HTTP Cookie Manager there is no need to extract it, if you need to send it as the parameter in the HTTP Request sampler you can add the next line to user.properties file:

    CookieManager.save.cookies=true
    

    and once you restart JMeter to pick up the property you will be able to access the token value as ${COOKIE___RequestVerificationToken} where required

More information: HTTP Cookie Manager Advanced Usage - A Guide

Upvotes: 1

Related Questions