Link to home
Start Free TrialLog in
Avatar of lilkiddoe
lilkiddoe

asked on

changing location of cache/cookies/history of the webbrowser control

Is there any way to change the location of the cache/history of the webbrowser control? Like where it writes all its cookies? I don't mind using the SHDocVw.InternetExplorer class either.

I know that you can change the cookies directory and such inside the registry, however that only works for IEXPLORER.EXE, it will not work for anything you put in your program. If you use the webbrowser control or the internetexplorer class from your program, it will use the default directory C:\Documents and Settings\User\Cookies, and it won't use the directory that you set in the registry.

Does anyone know how to change these locations inside your program?
Avatar of rajaamirapu
rajaamirapu

I have got a Rough idea i think you can do it with InternetSetOption.
See help on InternetSetOption
Avatar of lilkiddoe

ASKER

ok i'll look into that..
Dim blnOptionSet As Boolean
blnOptionSet = InternetSetOption(vbNull, INTERNET_OPTION_SETTINGS_CHANGED, vbNull, 0&)
MsgBox blnOptionSet

It keeps on returning false.. INTERNET_OPTION_SETTINGS_CHANGED = 39, this flag is supposed to tell the application that the registry has been updated. But blnOptionSet keeps returning false, am I doing something wrong?
ok.. i changed it to..

blnOptionSet = InternetSetOption(0&, INTERNET_OPTION_SETTINGS_CHANGED, 0&, 0&)

and it returned true.. i updated all the cookies directory in the registry, and it's still putting its cookies / cache inside the original directory specified by the registry when i started visual basic.

ASKER CERTIFIED SOLUTION
Avatar of rajaamirapu
rajaamirapu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Dim blnOptionSet As Boolean
blnOptionSet = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)
MsgBox blnOptionSet

blnOptionSet = InternetSetOption(0&, INTERNET_OPTION_SETTINGS_CHANGED, vbNull, 0&)
MsgBox blnOptionSet

Just tried it.. that happens to not make a difference. However, before you submitted that comment.. I figured out that

1. all internet explorers have to be closed in order for the change in the registry to work.
2. even so, it will only work with internet exploer OBJECTS
3. it will not work with the webbrowser control that we draw on the form..

i'll give you some credit for that, but i would like further help..
Avatar of DanRollins
Moderator, my recommended disposition is:

    Accept rajaamirapu's comment(s) as an answer.
   *** Mod, another option would be to decrease the points, as Akser wished ("some credit").

DanRollins -- EE database cleanup volunteer