jeudi 29 octobre 2015

c# webbrowser coding to navigate local to html

I'm trying to put a local html location address to the web browser in my C# application but always failed. I'm using debug mode now so the html files had already copied into my Debug folder because i put copy always in the copy to output option. Below is my code:

        string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
        string filePath = Path.Combine(appPath, "index.html");
        webBrowser1.Navigate(new System.Uri(@"file://"+ filePath));

There always error coming out using that way. Any idea what went wrong?




Aucun commentaire:

Enregistrer un commentaire