Tuesday, December 2, 2008

C# - Open a Browser with a certain URL

To open up a URL utilizing C# use the following code:


string url = @"http://www.google.com";
Process.Start("rundll32.exe", "url.dll,FileProtocolHandler \"" + url + "\"");

2 comments:

doctajonez said...

Hello, I've just found your blog and I'd like to say, it's very good and a fun read :)

Thanks for the tip, this is better than launching internet explorer and passing it a command line because your solution will launch the default web browser instead. Very nice.

Thanks,

DoctaJonez

Christina said...

Thanks so much for your compliment! I hope to be more active in my blogging now that my projects have died down a little. :)