c# - How to parse HttpWebResponse.Headers.Keys for a Set-Cookie session id returned -


I am trying to create a HTTP Webband / HTTP Webbash session with an ASP.NET website so that the URL parameter (this Part I know how to do that), but I do not understand how to parse and set a cookie in the form of session IDs in Fiddler, it shows that the ASP.NET session ID / path of the URL In response to the request, returned through the set-cookie, take Low I can figure out how this session IDs and can set it as a cookie for the next HTTP Vebarakvest? I understand that the set-cookie title will be found in HttpWebResponse.Headers.Keys, but is there a direct way to parse it? Thanks!

.NET Framework will manage cookies for you. You do not have to worry about parsing cookie information with headers or adding cookie headers to your requests.

To store and send your session IDs, store them and use classes, and then make sure that you send your cookies with every request.

The following examples show how to do this. Cookie Container, ' cookies can be shared in many domains and requests. Once you add it to a request object, its reference will be added to the response object, when the response is returned.

  CookieContainer cookiejar = new cookieContainer (); Var Request = (HttpWebRequest) HttpWebRequest.Create ("http://www.google.com"); Cookie container = cookies; Var response = request GetResponse (); Foreign currency (cookiej.GetCookies (request.RequestUri) in cookies {Console.WriteLine ("Cookie ['" + c.Name + "']:" + c.value); }  

This code will output:

cookie ['PREF']: ID = 59 A9A22A8CAC 2435: TM = 1246226400: Lm = 1246226400: S = T VTNBHK4N7 Tliipu


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -