Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load local *.htm file to WPF WebBroswer with relative path [duplicate]

Tags:

browser

c#

wpf

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!

like image 747
VilemRousi Avatar asked Dec 17 '25 11:12

VilemRousi


1 Answers

Have you tried using

Path.GetFullPath(YourRelativePath)

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

like image 145
Holf Avatar answered Dec 20 '25 03:12

Holf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!