Re: HttpWebRequest/Response with e-mail attachments
From: Joerg Jooss (joerg.jooss_at_gmx.net)
Date: 08/31/04
- Next message: Rutger Smit: "Re: PLS HELP: HTML email = wierd results"
- Previous message: Steve C. Orr [MVP, MCSD]: "Re: Add an image at runtime"
- In reply to: tomer: "Re: HttpWebRequest/Response with e-mail attachments"
- Next in thread: tomer: "Re: HttpWebRequest/Response with e-mail attachments"
- Reply: tomer: "Re: HttpWebRequest/Response with e-mail attachments"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 31 Aug 2004 22:51:05 +0200
tomer wrote:
> Joerg,
>
> Thanks for the tip, it turned out to be rather useful.
> I managed to see what's the difference between my request and IE's
> request. I turns out that IE sends the request with a cookie, which I
> can't seem to find anywhere, guess it's the login cookie...
> If I copy the cookie from fiddler's IE request and send my request
> with it, it all goes well.
> Now I only need to find a way to get this cookie.
> D'you know any method of extracting cookies out of pages? am I even
> in the right direction?
That's why I asked whether you're using an empty CookieContainer with your
initial request ;-)
You have to create an CookieContainer for your request, otherwise there will
be no cookies in the response:
HttpWebRequest firstRequest = (HttpWebRequest) WebRequest.Create(url);
firstRequest.CookieContainer = new CookieContainer();
HttpWebResponse firstResponse = (HttpWebResponse)
firstRequest.GetResponse();
HttpWebRequest secondRequest = (HttpWebRequest) WebRequest.Create(url);
secondRequest.CookieContainer = new CookieContainer();
CookieCollection cookies = firstResponse.Cookies;
secondRequest.CookieContainer.Add(cookies);
Cheers,
-- Joerg Jooss joerg.jooss@gmx.net
- Next message: Rutger Smit: "Re: PLS HELP: HTML email = wierd results"
- Previous message: Steve C. Orr [MVP, MCSD]: "Re: Add an image at runtime"
- In reply to: tomer: "Re: HttpWebRequest/Response with e-mail attachments"
- Next in thread: tomer: "Re: HttpWebRequest/Response with e-mail attachments"
- Reply: tomer: "Re: HttpWebRequest/Response with e-mail attachments"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|