
 Rank: Guest Groups: Guest
Joined: 9/17/2007 Posts: 11,670 Points: -1,200
|
Date parsed: 07/10/2007 02:44:58 Date: Sun, 07 Oct 2007 09:44:58 -0700
Hi,
does anybody know if it is possible to pass the SessionID with a web request by using a cookie so that the invoked page in the same domain can access the session objects of the current user?
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.CookieContainer = new CookieContainer(); HttpCookie sessionCookie = HttpContext.Current.Request.Cookies["ASP.NET_SessionId"]; request.CookieContainer.Add(new Cookie(sessCookie.Name, sessCookie.Value, "/", "localhost")); HttpWebResponse response = (HttpWebResponse)request.GetResponse();
This example doesn't seem to work for me but I do not know why... at least I get a timeout when I execute the code above although the mechanism works for every other cookie type, too. If I start a HttpWebRequest without any session information, the target page has a new and different sessionID than the soure page.
Thanks for the help
Andre
|