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.

2
  • Looks like System.Diagnostics.Process.Start is the right command from c# Commented Jun 20, 2012 at 4:13
  • 1
    what are you using c# console app/ asp.net form/asp.net mvc ? Commented Jun 20, 2012 at 4:15

2 Answers 2

4

you can use web browser control

webbrowser.Navigate("File location.html")

for more information see here

Sign up to request clarification or add additional context in comments.

2 Comments

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?
use this "Application.StartupPath" for getting your appication startup path
0
System.Diagnostics.Process.Start(
  Server.MapPath("~/HtmlFileFolderNameInSolution/") + "HtmlFileName.htm"
);

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

1 Comment

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;??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.