How to read an existing html file in the WebBrowser control in WP7?

advertisements

How to read an existing html file in the WebBrowser control in WP7?

I have tried:

  1. Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("abc.htm"); StreamReader reader = new StreamReader(stream); string html = reader.ReadToEnd(); Browser.NavigateToString(html);

  2. Browser.Navigate(new Uri("abc.htm", UriKind.Relative));

  3. var rs = Application.GetResourceStream(new Uri("abc.htm", UriKind.Relative)); StreamReader sr = new StreamReader(rs.Stream); string html = sr.ReadToEnd(); Browser.NavigateToString(html);

All three are not working. The methods 1 and 3 gives NullReferenceException because the stream returns null, basically it is not reading my html file.

What is the problem here? How can i fix it?


When you use number 3, make sure your HTML file has its build type set to 'Content'.