Monday, December 11, 2006

Open IE for a specific URL in C#

The Simplest way is (works very well):

System.Diagnostics.Process.Start(sURL);

But this will open the default browser in your system.

Another way is create Internet Explorer Application using shdocvw.dll:

using SHDocVw; // Contains the Internet Explorer reference

InternetExplorer oIE = new InternetExplorer();

if (oIE != null)
{
object oEmpty = String.Empty;
object oURL= sURL;
oIE.Visible = true;
oIE.Navigate2 (ref oURL, ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
}