1

I have stored an HTML file in IsolatedStorage as test.html.

In UI I have a WebBrowser component called browser. I'm using the following code to show the webpage in the browser:

browser.Navigate(new Uri("isostore:/test.html", UriKind.Absolute));

However it's giving me the prompt to search for an app in store, as if I'm trying to use LaunchUriAsync or LaunchFileAsync API.

I guess the problem is with the Uri format. What should be the correct Uri format in this case?

Robert MacLean
  • 38,975
  • 25
  • 98
  • 152
Abhishek
  • 1,349
  • 8
  • 17
  • possible duplicate of [Use local images in Webbrowser control](http://stackoverflow.com/questions/10363174/use-local-images-in-webbrowser-control) – Robert MacLean Jan 10 '14 at 16:59

2 Answers2

3

I have solved it, by removing 'isostore:/' prefix from the Uri string. I know that without any prefix the file path would refer to the application folder, not the isolated storage. It seems they've made an exception for the WebBrowser component. This is what works now:

browser.Navigate(new Uri("test.html", UriKind.Relative));
Abhishek
  • 1,349
  • 8
  • 17
1
C:/Data/Users/DefApps/AppData/{43F7CB8F-D4CF-425D-96BD-CD96D3FF44DC}/Local/test.html

The path above is an alternative and absolute path to the isolated storage. This string, {43F7CB8F-D4CF-425D-96BD-CD96D3FF44DC}, is unique to the app but can be set/found from within the properties folder of your visual studio project. You can also obtain it by using the following lines in the C# code:

StorageFolder localFolder = ApplicationData.Current.LocalFolder;
        String mystring = localFolder.Path;
conor
  • 155
  • 11
  • I tried the above snippet. However, on calling browser.Navigate with this path (with UriKind.Absolute), I get an exception with error code 80004005. – Abhishek Nov 20 '13 at 10:13