4

Possible Duplicate:
Load local HTML file in a C# WebBrowser

I´m creating program in C# (VS 2010), and I´d like to show help file. I created file help.htm. This file is included to solution in help directory. And I´d like this htm file load to webBroswer in Dialog. But there is a probelm, when I try to use relative path.

            HelpWindow helpwin = new HelpWindow(); //creating new window

            Uri helpUri = new Uri ("help\\pm_view.htm",UriKind.RelativeOrAbsolute); //setting path

            helpwin.webBrowser.Navigate(helpUri); //navigating webBroswer

After that, i get error: Relative URIs are not allowed. Parameter name: source

There is my C# solution schema in picture:

enter image description here

Please can anyone help?!

Thanks a lot!

Community
  • 1
  • 1
VilemRousi
  • 2,082
  • 4
  • 24
  • 34

2 Answers2

3

Have you tried using

Path.GetFullPath(YourRelativePath)

as per this answer: Answer on relative paths in WPF?

Community
  • 1
  • 1
Holf
  • 5,605
  • 3
  • 42
  • 63
-1

I wrote a short article about this: WebBrowserEx: WinForms WebBrowser + HTTP Server

The code is for WinForms, but you could modify it for WPF.

Nick Butler
  • 24,045
  • 4
  • 49
  • 70