Abhishek
Abhishek

Reputation: 1379

Opening html file from IsolatedStorage in a WebBrowser componenet in Windows Phone

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?

Upvotes: 1

Views: 1170

Answers (2)

Abhishek
Abhishek

Reputation: 1379

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));

Upvotes: 3

conor
conor

Reputation: 155

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;

Upvotes: 1

Related Questions