Tip 3: URL Encoding
This tip is a fairly simple one, but I often use it when building scripts.
URL encoding is quite often needed in heavier webapplications on the variables you extract with the Regular Expression extractor or other extractors.
How do you make this variable URL Encoded when not using the standard “Parameters” but you need to use the Body Data instead?
The given variable we are going to encode is something I see rather too often, a ViewState. In order to grab this thing from the page I have the following regular expression:
Reference Name: VIEWSTATE Regular Expression: id="__VIEWSTATE" value=(.+?)"
So, now we have a variable ${VIEWSTATE} which needs URL Encoding. The way to do this, within the Body Data is as follows:
${__urlencode(${VIEWSTATE})}
So whatever your variable is, just put it in between the brackets in the ${__urlencode()} and you have your encoded variable.