c# - System.Windows.Controls.WebBrowser Navigate to html-file on disk -


i feel stupid cant figure 1 out.

this works flawless;

((system.windows.controls.webbrowser)e.control).navigate(new uri("http://www.google.com")); 

but when try navigate file on disk fails

string path =@"d:\dev\mysite.html";  ((system.windows.controls.webbrowser)e.control).navigate(new uri(path)); 

i guess cant use uri else should use navigate file on disk?

full code;

    private void webcontrolavailable(object sender, controlavailableeventargs e)     {           string path =@"d:\dev\mysite.html";          ((system.windows.controls.webbrowser)e.control).navigate(new uri(path));      } 

using system.windows.controls.webbrowser navigate local files quite tough one. can try one, though:

string path =@"file://127.0.0.1/d$/dev/mysite.html"; ((system.windows.controls.webbrowser)e.control).navigate(new uri(path)); 

if have javascript 1 site might little ugly , fail.

you can use system.io.stream navigate, using webbrwoser.navigatetostream(), see this thread on , official documentation.


Comments

Popular posts from this blog

ios - UITEXTFIELD InputView Uipicker not working in swift -

Hatching array of circles in AutoCAD using c# -