Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » How to retrieve a cookie from webpage?


How to retrieve a cookie from webpage?

Reply
  #1 (permalink)  
Old 03-07-04, 08:37 AM
z94joma z94joma is offline
New Member
 
Join Date: Mar 2004
Location: Sweden
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
How to retrieve a cookie from webpage?

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
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieve Image from an Access Db Paulgood30 ASP.NET 1 11-15-03 10:41 AM
Create a next page link when there are too many records to be display in a webpage Han84 ASP 0 10-19-03 10:32 PM
retrieve data from combo box sasi ASP 1 09-03-03 06:16 PM
retrieve data from database vioss PHP 4 08-03-03 04:51 AM
Weird cookie request. grawss Script Requests 0 07-19-03 10:30 PM


All times are GMT -5. The time now is 02:20 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.