Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading the cookies set by IE/NN through VB application

Status
Not open for further replies.

varshney

Programmer
Aug 21, 2001
1
DO
Hi All,
I want to know if there is a way so that the VB application can read the cookies set by IE or NN?

Thanx,
Varshney
 
sure, just go to the appropriate directory, look for the file you want and open it. They are just little text files.
 
It's fairly simple... depending on the information you want to retrieve from the cookies. The following code just lists the Internet addresses contained in the cookies stored at a certain location.
Add a list box to a form and place the following code in a command button. (Make sure the Cpath$ variable refers to the correct folder.)
[tt]
Cpath$ = "d:\windows\profiles\Alt255\cookies\"
F$ = Dir(Cpath$ & "*.txt")
Do While F$ <> &quot;&quot;
ff = FreeFile
Open Cpath$ & F$ For Binary As #ff
A$ = String$(LOF(ff), 32)
Get #ff, 1, A$
Close
Va = Split(A$, Chr$(10))
If UBound(Va) > 1 Then
Found = False
For Re = 1 To List1.ListCount
If Va(2) = List1.List(Re) Then
Found = True
Exit For
End If
Next
If Found = False Then List1.AddItem Va(2)
End If
F$ = Dir
Loop
[/tt]
Remember that cookies are just text files. This little sub simply gets the third line from every *.TXT file in the designated folder.
VCA.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top