Search code examples
c#microsoft-edge

How to read the Microsoft Edge history using C#


I would like to access the history of Microsoft Edge, what should I do? As my research, we can delete the history of Edge programmatically by deleting the folders starting with # in the %LOCALAPPDATA%\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\AC folder, but in my case, I want to read them.

When I open a folder starting with #, i.e #!001, there are many sub folders there and I do not know where should I look at to get the data. And in my investigation, when I visit a website, it seems create a URLXXX.tmp in the temp folder and this file is encrypted. Is that the file I should look at? Also, there are some *.dat files, are there relevant?


Solution

  • Yes, the history is stored inside WebCacheV01.dat file. It is an ESE database (earlier known as Jet Blue). Microsoft provides api to access this database. Look for JetOpenDatabase, JetAttachDatabase api. However, this file is always in use by a task called CacheTask (See Microsoft\Windows\WinInet folder in Task Scheduler). You will need to stop this task before accessing this db. And then start this task again immediately. Because another COM Surrogate starts after few seconds DllHost.exe (3EB3C877-1F16-487C-9050-104DBCD66683) which will stop you from accessing WebCacheV01.dat. So you need to complete reading before the above COM Surrogate starts. The COM Surrogate starts only when CacheTask is not running. So if you re-start CacheTask immediately, then COM Surrogate will not start.

    UPDATE: Note that since Microsoft has replaced the old Microsoft Edge with Chromium based Microsoft Edge, the history/bookmark file format is same as Google Chrome. It is a sqlite db. Accessing data from this db is fairly easy using sqlite API.