S
Sriram Krishnan
You have to use a CookieContainer
Ya Ya said:I am trying to download a web page using WebRequest.
The problem is that this page uses cookies. In IE, I can view this page
correctly (since I have the cookie) but when downloading using WebRequest I
don't get the page I want.
How can I add cookie information to my WebRequest ?
How do I know which cookie information the page need ?
A code example will be great.
Here is my code:
Dim szDate As String = ""
Dim NetDataRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(szUrl)
Dim NetDataResponse As System.Net.WebResponse = NetDataRequest.GetResponse()
Dim StreamRead As System.IO.StreamReader
StreamRead = New System.IO.StreamReader(NetDataResponse.GetResponseStream(),
System.Text.Encoding.ASCII)
szDate = StreamRead.ReadToEnd()
NetDataResponse.Close()
StreamRead.Close()
Return szDate
Thanks for your time
(e-mail address removed)
Ya Ya said:Do you mean I need to do webRequest to the login page first (posting the
user/pass as parameters) , and then pass the CookieContainer to another
webRequest for the page I need ?