5 Answers, 1 is accepted
0
Hi Jet,
I apologize for the delay in getting back to you on this. Currently you have two options to get the ASP.NET_SessionId.
1. The first that you already know is via the headers of web response. Here's a sample code:
See this article for more information on how to use the Http Proxy.
2. The second method which I recommend is via the ActiveBrowser. The following code demonstrates how to do that:
Let me know if you need further assistance on this.
Regards,
Plamen
the Telerik team
I apologize for the delay in getting back to you on this. Currently you have two options to get the ASP.NET_SessionId.
1. The first that you already know is via the headers of web response. Here's a sample code:
ResponseListenerInfo li =
new
ResponseListenerInfo(ResponseHandler);
Manager.Http.AddBeforeResponseListener(li);
Manager.ActiveBrowser.NavigateTo(
"https://login.asp.net/login/signin.aspx?ReturnUrl=http://www.asp.net/get-started"
);
Manager.ActiveBrowser.WaitUntilReady();
Manager.Http.RemoveBeforeResponseListener(li);
private
void
ResponseHandler(
object
sender, HttpResponseEventArgs e)
{
System.Collections.Specialized.NameValueCollection headers = e.Response.Headers;
Log.WriteLine(headers[
"Set-Cookie"
]);
}
See this article for more information on how to use the Http Proxy.
2. The second method which I recommend is via the ActiveBrowser. The following code demonstrates how to do that:
Manager.ActiveBrowser.NavigateTo(
"https://login.asp.net/login/signin.aspx?ReturnUrl=http://www.asp.net/get-started"
);
Manager.ActiveBrowser.WaitUntilReady();
var id = Manager.ActiveBrowser.Cookies.GetCookies(
"https://login.asp.net/login/signin.aspx?ReturnUrl=http://www.asp.net/get-started"
);
Log.WriteLine(id[
"ASP.NET_SessionId"
].Value);
Let me know if you need further assistance on this.
Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0

Jet
Top achievements
Rank 1
answered on 14 Nov 2012, 01:00 AM
Thank you Plamen for your help.
My answer is not detailed, this cookie is "httponly", so I couldn't get it by your approaches. Looks like there has no way to get httponly cookies.
My answer is not detailed, this cookie is "httponly", so I couldn't get it by your approaches. Looks like there has no way to get httponly cookies.
0
Hi Jet,
When you tag a cookie with the HttpOnly flag, it tells the browser that this particular cookie should only be accessed by the server. Unfortunately this means that it cannot be accessed through the client side.
All the best,
Plamen
the Telerik team
When you tag a cookie with the HttpOnly flag, it tells the browser that this particular cookie should only be accessed by the server. Unfortunately this means that it cannot be accessed through the client side.
All the best,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0

Jet
Top achievements
Rank 1
answered on 15 Nov 2012, 10:39 AM
I use another way to do my testing.
Finally steps:
1, send a request by WebRequest and get the session from the header of response
2, set the cookie with the Manager.ActiveBrowser
3, fake same name( the httponly) cookie
Thanks.
0
Hi Jet,
I am glad to hear you found a workaround! Thanks for the update.
Kind regards,
Plamen
the Telerik team
I am glad to hear you found a workaround! Thanks for the update.
Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings