DotNetBrowser supports using HTML5 Application Cache to store the web application data and make them accessible without the Internet connection.

In DotNetBrowser 1.9 the API to list and remove the application cache entries has been introduced.

You can access the application cache storage interface via the Browser.AppCacheStorage property. The IAppCacheStorage interface provides the following properties and methods:

  • OriginURLs property - a list that contains URLs of all known application cache origins.
  • GetInfoByOriginURL - returns all application cache storage information that is present for the specific origin URL.
      If the application cache contains any manifests bound to the specified origin, these manifests can be obtained via the IAppCache.Manifests property.
  • RemoveInfoForManifestURL - removes all the application cache entries bound to the manifest with the specified URL.

Example

C#

//Get all known origin URLs
IEnumerable<string> originURLs = browser.AppCacheStorage.OriginURLs;
//Get application cache infor for the first origin
if (originURLs.Any())
{
    IAppCache originInfo = browser.AppCacheStorage.GetInfoByOriginURL(
                    originURLs.First());
    //Get all known manifests
    IEnumerable<IAppCacheInfo> manifests = originInfo.Manifests;
    //Remove all entries for this origin
    foreach (IAppCacheInfo manifestInfo in manifests)
    {
        browser.AppCacheStorage.RemoveInfoForManifestURL(manifestInfo.ManifestURL);
    }
}

VB.NET

'Get all known origin URLs
Dim originURLs As IEnumerable(Of String) = browser.AppCacheStorage.OriginURLs
'Get application cache infor for the first origin
If originURLs.Any() Then
    Dim originInfo As IAppCache = browser.AppCacheStorage.GetInfoByOriginURL(originURLs.First())
    'Get all known manifests
    Dim manifests As IEnumerable(Of IAppCacheInfo) = originInfo.Manifests
    'Remove all entries for this origin
    For Each manifestInfo As IAppCacheInfo In manifests
        browser.AppCacheStorage.RemoveInfoForManifestURL(manifestInfo.ManifestURL)
    Next
End If