HTTP URL Re-writing Modifier

For web applications that use URL Re-writing to store session ids instead of cookies, this element can be attached at the ThreadGroup level, much like the HTTP Cookie Manager. Simply give it the name of the session id parameter and it will find it on the page and add the argument to every request of that ThreadGroup.

Correlation with HTTP URL Re-writing Modifier:

To use HTTP URL Re-writing Modifier we have to record a scenario where session ids are created. This element will grab the parameter values from previous response. It will find the parameter anywhere it exists on the page, and grab the value assigned to it, whether it’s in an HREF or a form.

Steps:

1. Record the site.

url1

When you run the script it will show session expired in the listener. (View result tree->response data in Html rendered).The result may appear in red as failure.

Check the sample which sends session ids as requests to the server. (Look in the send parameter with request field of the sample). There are two variables- BV_SessionID and BV_EngineID. The values of these session IDs comes from the server in the previous request. So these values are sent back again to the server by the browser as request in this sample. For each run these values change. So we have to replace them dynamically. We will add HTTP URL Re-writing Modifier (pre processor) to this sample which will fetch the session ids from previous sample.

url2

2. Select the sample. Add a HTTP URL Re-writing Modifier (add-> pre processor-> HTTP URL Re-writing Modifier).

In this example there are two session ids as shown in send parameter with request field. Put the session Variable name (here BV_SessionID) in Session Argument Name.

url3

Here we add another HTTP URL Re-writing Modifier for the second session ID. Don’t forget to select the Cache Session Id? Option in the URL re-writing Modifier.

3. Now change the variable values to * in the sample.

url4

4. Save and run the script. The result will be successful.

url5