Friday, March 20, 2009

How do I filter sessionid from a header?

e.g header: ARPT=YMXXXKS192.168.100.218CKQIY; path=/,JSESSIONID=3F523783B77C8E8EDEE5F5FE5B8FE99A; Path=/ I just want to grab JSESSIONID and value.

-----------------------------------------------------------------------------------------------
Code Snippet
using System.Net;

public class ExtractJSESSIONID : WebTestRequestPlugin
{
public override void PostRequest(object sender, PostRequestEventArgs e)
{
foreach (Cookie cook in e.Response.Cookies)
{
if (cook.ToString().StartsWith("JSESSIONID="))
{
e.WebTest.Context.Add("JSESSIONID", cook.Value.ToString());
}
}
}
}

No comments:

Unix/Linux Commands

  Flow control Syntax break Exit a loop. continue Exit the current iteration of the loop and proceed with the next iteration. Ctrl+C Key com...