十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
C#调用浏览器是如何实现的呢?我们在实际的开发过程中会遇到这样的需求,那么来实现C#调用浏览器会用到什么方法呢?这里向你介绍了调用IE以及默认浏览器的具体操作。

C#调用浏览器之调用IE:
- System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
 - myProcess.StartInfo.FileName = "iexplore.exe";
 - myProcess.StartInfo.Arguments = " http://www.net0and1.com/";
 - myProcess.Start();
 
C#调用浏览器之调用默认浏览器:
- string target= "http://www.net0and1.com";
 - //Use no more than one assignment when you test this code.
 - //string target = "ftp://ftp.microsoft.com";
 - //string target = "C:\\Program Files\\Microsoft Visual Studio\\INSTALL.HTM";
 - try
 - {
 - System.Diagnostics.Process.Start(target);
 - }
 - catch
 - (
 - System.ComponentModel.Win32Exception noBrowser)
 - {
 - if (noBrowser.ErrorCode==-2147467259)
 - MessageBox.Show(noBrowser.Message);
 - }
 - catch (System.Exception other)
 - {
 - MessageBox.Show(other.Message);
 - }
 
C#调用浏览器的操作就向你介绍到这里,希望对你了解和学习使用C#调用浏览器有所帮助。