Cookies and vb.net

tohnsm

New member
Joined
Sep 20, 2007
Messages
4
Programming Experience
1-3
Hi.

I have been trying to create a cookie container. But the cookie I have stored is not correct.
VB.NET:
request = CType(WebRequest.Create("....."), httpWebRequest) 

request.CookieContainer = New CookieContainer() 
myCookie = request.CookieContainer  ' store the cookie as global variavble 
.
.
.
'above request is a GET, after which I needed to POST

Dim request1 As HttpWebRequest
request1 = CType(WebRequest.Create("URL here is obtained from the response of the GET request previously"), HttpWebRequest)
request1.CookieContainer = myCookie        
request1.Method = "POST"
GET is successful but POST failed. I have used a program to track my packets and realised that the GET and POST requests are treated together as 1 packet.

In addition, the cookie sent over by the POST request contains

Cookie: $Version=1; Aqu=lt=1190340857; $Path=/; $Version=1; JJ=uuid-4ec51e83-bebd-4c94; $Path=/

This is rather weird as when I use normal IE to access the same website and login, the cookie I sent over will not contain "$Path=/; $Version=1".

In addition, for the POST request the response will be 403 forbidden. I suspect my cookies are wrong.

Can anyone advise on how I can remove "$Path=/; $Version=1" from the cookies?

By the way, does anyone know why GET and POST requests are treated as only 1 packet?

Many thanks.
 
Last edited by a moderator:
Back
Top