0

First of all, thank you all for taking time to read the question.

I am embedding Microsoft WebBrowser ActiveX control into my application. Normally such a WebBrowser instance saves cookies and caches to the system default location C:\Users\${foo}\AppData\Roaming\Microsoft\Windows\Cookies.

I want to store cookies in another directory. SFAIK that WebBrowser control uses WinINet to access caches and cookies. I think I should call InternetSetOption with a proper option flag. Can anybody shed some light on it?

stanleyxu2005
  • 8,081
  • 14
  • 59
  • 94

1 Answers1

1

WinInet does not give you the option of programmably changing the paths of its storage folders. The location of the Cookies and Cache folders are part of the calling user's profile instead.

Specifically, they are determined by the CSIDL_COOKIES and CSIDL_INTERNET_CACHE shell folders (FOLDERID_Cookies and FOLDERID_InternetCache on Vista+), which are configured in the following Registry key:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • Thanks. The demand is that when my WebBrowser control access Internet, cookies and caches should be stored NOT into the same location as MSIE does. If I change the registry key, MSIE will also same data to the new location, won't it? – stanleyxu2005 May 10 '14 at 01:37
  • Yes, as will any other WInInet-based or WinHTTP-based app, or any app that uses the Cookie/Cache folders directly. you are out of luck, you CANNOT have your WebBrowser control use its own folders without affecting any other app. Find another third-party WebBrowser control that does not have that restriction. – Remy Lebeau May 10 '14 at 02:44
  • I saw two Chinese browsers (SogouExplorer and 360 SafeBrowser), which will manage cache/cookies/history items in individual directories. It is quite interesting, but maybe they are not WinInet based. If WinInet is a wrong way, I might should look into some other directions. – stanleyxu2005 May 10 '14 at 07:11
  • WinInet does not offer the amount of freedom you want. [EmbeddedWB](http://sourceforge.net/projects/embeddedwb/) is a common alternative for Delphi projects, for example. – Remy Lebeau May 10 '14 at 07:43
  • EmbeddedWB is a wrapper of TWebBrowser. In other words, it has nothings specific to handle cookies stuff. – stanleyxu2005 May 13 '14 at 06:54