468,133 Members | 1,242 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,133 developers. It's quick & easy.

How to get and pass cookies.

Kevinyy
77
I'm working on a proxy and i was wondering how i can collect the cookies and pass them back to the client? so they can log into sites and etc? here is my http receive code and pass the info back:
Expand|Select|Wrap|Line Numbers
  1. System.Net.Configuration.HttpWebRequestElement wr = new System.Net.Configuration.HttpWebRequestElement();
  2. wr.UseUnsafeHeaderParsing = true;
  3. HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  4. CookieContainer cookieContainer = new CookieContainer();
  5. request.CookieContainer = cookieContainer;
  6. request.CookieContainer.Add(cookieContainer.GetCookies((Uri)url));
  7. HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  8. Stream responsestream = response.GetResponseStream();
  9. byte[] buffer = new byte[bz];
  10. rebu = responsestream.Read(buffer, 0, bz);
  11. while (rebu != 0)
  12. {
  13.     soket.Send(buffer, rebu, 0);
  14.     rebu = responsestream.Read(buffer, 0, bz);
  15. }
  16.  
how can i gather the cookies and pass them back?
-Thanks

C#.Net3.5
Oct 8 '08 #1
3 1616
Kevinyy
77
Can anyone help? I have not yet resolved this problem
Oct 10 '08 #2
Frinavale
9,735 Expert Mod 8TB
You can use the Request.Cookies collection to retrieve cookies.

As for passing them along......I'm not sure what you're trying to do.

-Frinny
Oct 10 '08 #3
Kevinyy
77
You can use the Request.Cookies collection to retrieve cookies.

As for passing them along......I'm not sure what you're trying to do.

-Frinny
im writing a cookie compliant proxy.
Oct 11 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Naseem | last post: by
6 posts views Thread by taylor.ettema | last post: by
2 posts views Thread by =?Utf-8?B?U3RldmVuIFRhbmc=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.