Re: Net.WebRequest - Close Connection

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi Jack,

Although you make the webrequest a global variable, but you are recreating
it on each request by Net.WebRequest.Create(strUrl).

To maintain the session after you first logged on, you need to use a
CookieContainer to store the cookies you obtained after the first request
to logon. For more information, see
http://blogs.vbcity.com/drydo/archive/2005/09/27/5556.aspx

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • Re: Where is HttpSession ? System.net or System.web?
    ... > I'm trying to do a http request and read a http session. ... initial request has a CookieContainer instance associated with it. ...
    (microsoft.public.dotnet.framework)
  • Re: Can not get cookies from a web page.
    ... I used the CookieContainer class but even this is not working.. ... HttpWebRequest request = ... I am making a http request to a html page residing on a server through ... For this page I have some cookies set on my local browser. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Net.WebRequest - Close Connection
    ... am doing for my logon and response. ... it on each request by Net.WebRequest.Create. ... CookieContainer to store the cookies you obtained after the first request ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Can not get cookies from a web page.
    ... Here's a short example of using the CookieContainer: ... HttpWebRequest request = ... I am making a http request to a html page residing on a server through ... For this page I have some cookies set on my local browser. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: HttpWebRequest and Session Information
    ... In theory you create CookieContainer once and use it with every request. ... HttpWebRequest will automaticly use it and update if needed. ... I belive the cookie's name fro ASP.NET session is changing all the time ...
    (microsoft.public.dotnet.framework.aspnet)