Dim request As HttpWebRequest = CType(WebRequest.Create(args(0)), HttpWebRequest) request.CookieContainer = New CookieContainer() Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse) ' Loop through the cookie collection and display each property Dim _cookie As Cookie For Each _cookie In response.Cookies Console.WriteLine("Cookie:") Console.WriteLine("{0} = {1}", _cookie.Name, _cookie.Value) Console.WriteLine("Domain: {0}", _cookie.Domain) Console.WriteLine("Path: {0}", _cookie.Path) Console.WriteLine("Port: {0}", _cookie.Port) Console.WriteLine("Secure: {0}", _cookie.Secure) Console.WriteLine("When issued: {0}", _cookie.TimeStamp) Console.WriteLine("Expires: {0} (expired? {1})", _cookie.Expires, _cookie.Expired) Console.WriteLine("Don't save: {0}", _cookie.Discard) Console.WriteLine("Comment: {0}", _cookie.Comment) Console.WriteLine("Uri for comments: {0}", _cookie.CommentUri) Console.WriteLine("Version: RFC {0}", IIf(_cookie.Version = 1, "2109", "2965")) ' Show the string representation of the cookie. Console.WriteLine("String: {0}", _cookie.ToString()) ' Show sessionId of the cookie. Console.WriteLine("SessionId: {0}", _cookie.Value) Next _cookie
Showing posts with label cookies. Show all posts
Showing posts with label cookies. Show all posts
Wednesday, September 2, 2015
How to loop through multiple cookies from an HttpWebResponse
Subscribe to:
Posts (Atom)