471,310 Members | 1,211 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Cookie Handling: Sending saved cookies in httprequest

Not sure I've posted this in the right place but here's the problem.

I've made some progress but I'm stuck. I can find and use the data in a
required cookie and send it in the httprequest as hard-coded for a test. Of
course I need this to be part of the automated request process as if I was
using a
browser. Surely there is a method to automatically find the cookie, extract
the right property and make this happen? I can't find it.

Scenario:
Website uri is http://www.pageiwant.com.
Page I want is http://www.pageiwant.com/here?.php?m=meetup
I have logged in via browser and cookie is set
Cookie is C:\Docs\Own\Cooks\ow***@www.pageiwant[1].txt
Property I want in cookie is ABCD (cookie.name)which has been set to
G7789Ooqdowjkc7rrFA28r5hp0f78e (cookie.value) when the browser was used to
log in to website.

Here is my test code that does the job:

Dim uri As New Uri("http://www.pageiwant.com/here?.php?m=meetup")
Dim cookUri As New Uri("http://www.pageiwant.com")
Dim request As HttpWebRequest
Dim response As HttpWebResponse

Try
request = CType(WebRequest.Create(uri), HttpWebRequest)
request.CookieContainer = New CookieContainer
request.CookieContainer.SetCookies(cookUri,
"ABCD=G7789Ooqdowjkc7rrFA28r5hp0f78e")

'Rest of code goes here

The above authenticates me using the cookie value as if I was using a
browser. What is the best way to automate this for any client machine. There
must be a way :)

TIA

JD/Simon

Jul 21 '05 #1
0 1200

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by N.K | last post: by
3 posts views Thread by M Wells | last post: by
3 posts views Thread by Ana | last post: by
9 posts views Thread by Sullivan WxPyQtKinter | last post: by
29 posts views Thread by Jerim79 | last post: by
2 posts views Thread by Sean | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.