How to open web page from windows application (C#/NET)
Some time its requiring to open IE from dot net application. For example: If you want your window application opens the web (.aspx) page. Then you require some code that should call web application and start the web project.
You can open any web site through this application like: www.yahoomail.com, www.gmail.com etc.
Follow the three simple step to create this application.
1) Give the web reference of Microsoft.mshtml.dll and Interop.SHDocVw.dll DLLs to your project
b) Download DLL from net and put into "\...\obj\Debug\Interop.SHDocVw.dll" folder
2) Create one cs file Browser.cs in same project
public class Browser
public static IWebBrowser2 TheInstance = new InternetExplorerClass() as IWebBrowser2;
3) Add this on the top of the page
write following code in the onload event or Startup event.
object missing = System.Reflection.Missing.Value;
// any URL you can put here like: www.yahoomail.com etc.
ref missing, ref missing, ref missing, ref missing);
Browser.TheInstance.Visible = true;
IHTMLDocument2 doc = Browser.TheInstance.Document as IHTMLDocument2;
IHTMLElement body = doc.body;
IHTMLElementCollection children = body.all as IHTMLElementCollection;
foreach (IHTMLElement child in children)
if (child.id != null)
string elementName = child.id.Trim();
//if you know in that web page one button control name
//is "btnStartQueue" then you can do click operation from below code
if (elementName.Trim() == "btnStartQueue")