Open a URL in the Default Browser in Your .NET Application
Posted by johnnythawte in C programming
Virtually every application these days requires at least some connection to the internet. Letting the user click a link and open it in their browser is essential. This recipe shows you the 1 line method of doing so.
This is the absolute simplest way to launch a URL in a .NET application:
System.Diagnostics.Process.Start("http://www.tech-recipes.com");
Just put this code in the click event for your control, and replace the URL in the sample code with your URL.
The Conversation
Follow the reactions below and share your own thoughts.
June 11, 2009 at 11:30 pm, moises said:
thanks!!
May 30, 2010 at 2:41 am, Anonymous said:
Awesome, thanks for this!
December 27, 2010 at 2:10 pm, mohammad said:
thanks v.v.v.v.v.v.v.v.thanks
March 11, 2011 at 8:15 am, ronnie said:
is possible to pass post data in opening web browser?
June 10, 2012 at 10:46 am, madhab kumar said:
I love my eyes when U look into them,
I love my name when U say it, from- madhab kumar , sana aryapalli
April 06, 2013 at 11:33 pm, Sau Hi said:
How can I open a link with chosen browser. EX: Open link with Firefox but my default browser on computer is IE?