reading and writing cookies

  • Thread starter Thread starter Adrian
  • Start date Start date
A

Adrian

Hi
How do I read and write a cookie in VB dotnet in Vb 6 I did so:

bRet1 = InternetGetCookie("http://xxxx/xxxx.htm", "user", sCookieVal1,
255)


bRet1 = InternetSetCookie("http://xxxx/xxxx.htm", "user", txtUserName.Text &
"; expires = " & Format$(DateAdd("y", 10, Now()), "ddd, dd-mmm-yyyy 00:00:00
") & "GMT")
bRet2 = InternetSetCookie("http://xxxx/xxxx.htm", "Password",
txtPassword.Text & "; expires = " & Format$(DateAdd("y", 10, Now()), "ddd,
dd-mmm-yyyy 00:00:00 ") & "GMT")
If bRet = False Then
Debug.Print "Failed write"
End If

I guess I need to use system.net.CookieCollection but don't know how to go
about it :(

thanks
 
this what I have so far in my application:
Dim MyCookieCollection As New Net.CookieCollection

Dim MyCookie As New Cookie

MyCookie.Name = "1234567890abcd"

MyCookie.Value = "helpme"

MyCookieCollection.Add(MyCookie)

But it does not create a cookie as fare as I can tell , I need the cookie to
be persistent.
 
Back
Top