2

I have added an HTML file to my solution in VS2010. How do you create a call to open the HTML file? For example when a user clicks a button it will locate the HTML file in my solution and open it in the web browser.

Ry-
  • 209,133
  • 54
  • 439
  • 449
Jason Gagnon
  • 179
  • 3
  • 5
  • 11

2 Answers2

4

you can use web browser control

webbrowser.Navigate("File location.html")

for more information see here

Community
  • 1
  • 1
KF2
  • 9,421
  • 8
  • 39
  • 76
  • To: Gerard Sexton if i give the application to run on someone else machine it it confuse the path i stated on my machine with there's? – Jason Gagnon Jun 20 '12 at 04:01
  • use this "Application.StartupPath" for getting your appication startup path – KF2 Jun 21 '12 at 06:43
0
System.Diagnostics.Process.Start(
  Server.MapPath("~/HtmlFileFolderNameInSolution/") + "HtmlFileName.htm"
);

This will open HTML file in new tab of same browser...

alony
  • 10,525
  • 3
  • 36
  • 46
M Shoeb
  • 51
  • 3
  • what name space do i have to add when i am adding this in? everything works till Server.MapPath. does it fall under the System.Web;?? – Jason Gagnon Jun 21 '12 at 02:24