Posts Tagged 'Tip'

Open a Website from C#

It is often a requirement to open the default web browser and browse to a specific Url from a Windows Forms, WPF or even Console application. The easiest method I’ve discovered is to make use of the System.Diagnostics.Process class:

 using  System;
 using  System.Collections.Generic;
 using  System.Text;
 using  System.Diagnostics;
 namespace  OpenDefaultBrowser
     class  Program 
         static  void  Main(string [] args)
             Process .Start("" );

In most scenarios the code snippet listed above works without a problem. The only issue I foresee being in an environment where the user account used to execute your application not having sufficient permissions to execute the default browser application.

For more information see MSDN Process Class

Dewald Esterhuizen

Blog Stats

  • 831,506 hits

Enter your email address to follow and receive notifications of new posts by email.

Join 228 other subscribers


Twitter feed

%d bloggers like this: