How to load local HTML pages in WebBrowser control in C#

I have number of local HTML pages. I want to display these local HTML pages in Web browser control. When I add new page it should get append to previous page.

Here is the sample code for the setting Url

for( int i=0; i<=filecount; i++)
    web-browser.Url = new Uri(filepath[i]);

But during run time its showing the File Download pop up and web browser is empty.

Answers


You could load a single page as

FileStream source = new FileStream(filepath, FileMode.Open, FileAccess.Read);
webBrowser1.DocumentStream = source;

or even like

string html = File.ReadAllText(filepath);
webBrowser1.DocumentText = html;

But if you have images, css or js in the relative paths, use

Uri uri = new Uri(filepath);
webBrowser1.Navigate(uri);

webrowser.Navigate(filepath[i]); 

something like that i remember... ;)


Need Your Help

Where is JAVA_HOME on macOS Mojave (10.14) to Lion (10.7)?

java macos

Java is an optional package on the latest versions of macOS.

How to remove event listener in Chrome extension

javascript events event-handling google-chrome-extension

I am trying to remove the onRequest listener added by chrome.extension.onRequest.addListener after a request is made, like this: