z94joma
03-07-04, 09:37 AM
Hi!
I have a problem that I have dealt with a few days now and I dont get it to work. Could you plz suggest something here?
I need help to retrieve the cookie that the below site sends out. It is something like this "JSESSIONID= "
How can I retrieve this cookie and then use it again to login to the webpage. I just need the info on how to get the cookie out.
Thank you för your time....
/Magnus
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = readHtmlPage("http://www.stolpskott.net")
End Sub
Function readHtmlPage(ByVal url As String) As String
Dim objResponse As WebResponse
Dim objRequest As WebRequest
Dim result As String
objRequest = System.Net.HttpWebRequest.Create(url)
objResponse = objRequest.GetResponse()
MsgBox(objResponse.Headers.Item("Cookie"))
Dim sr As New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
'clean up StreamReader
sr.Close()
Return result
End Function
I have a problem that I have dealt with a few days now and I dont get it to work. Could you plz suggest something here?
I need help to retrieve the cookie that the below site sends out. It is something like this "JSESSIONID= "
How can I retrieve this cookie and then use it again to login to the webpage. I just need the info on how to get the cookie out.
Thank you för your time....
/Magnus
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = readHtmlPage("http://www.stolpskott.net")
End Sub
Function readHtmlPage(ByVal url As String) As String
Dim objResponse As WebResponse
Dim objRequest As WebRequest
Dim result As String
objRequest = System.Net.HttpWebRequest.Create(url)
objResponse = objRequest.GetResponse()
MsgBox(objResponse.Headers.Item("Cookie"))
Dim sr As New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
'clean up StreamReader
sr.Close()
Return result
End Function