Click to See Complete Forum and Search --> : VB and Cookies


mikeh
February 3rd, 2000, 08:39 AM
Hi,

I'm trying to write a VB6 app that has a WebBrowser control.

I use the Webbrowser.Navigate(URL) function to connect to a web site. Cookies are enabled on my machine.

I need to get hold of the cookie that is created when I goto the web site.

Any ideas how i can get to the cookie in VB, using this control.

Cheers
Mike

Lothar Haensler
February 3rd, 2000, 09:07 AM
here is a sample

option Explicit

private Sub Command1_Click()
w.navigate "http:yourURL"
End Sub

private Sub w_NavigateComplete2(byval pDisp as Object, URL as Variant)
Dim d as HTMLDocument
set d = w.document
MsgBox d.cookie
End Sub




you need to add a reference to the HTML Object Library (MSHTML.DLL) to your project to get acccess to the HTML document in your browser.

mikeh
February 3rd, 2000, 11:15 AM
Thanks for the code. It seems to return a Web escaped cookie. Do you know how to unescape it??

Cheers
Mike