For Programmers: Free Programming Magazines  


Home > Archive > C# > January 2006 > Getting System cookies









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Getting System cookies
Brian Hampson

2006-01-30, 3:57 am

I have a WebRequest that is posting various data.

Of course, it won't let you post the data if you're not "logged in". I
need to grab the cookies that are sitting in my IE cache for the site,
and send them up with the request.

Is there an easy way to do this? Is there ANY way to do this?

I have

HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);

I THOUGHT that I simply had to:

CookieContainer cc = new CookieContainer();
CookieCollection cookies = cc.GetCookies(wr.RequestUri);
cc.Add(cookies);
wr.CookieContainer = cc;

I was painfully wrong.

I'm running out of hair from pulling, and forehead from banging :(

Brian Hampson
System Adminsitrator, Americas
ALS Environmental

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com