-
C#打开指定网页的方法
一、
程序代码
ShellExecuteA(this.Handle,"open","http://www.caogenit.com ",null,"",5);
二、
程序代码
System.Diagnostics.Process.Start(e.LinkText);//打开网页
System.Diagnostics.Process.Start(filename);//加载文件
三、
程序代码
using System.Diagnostics;
Process ps=new Process();
ps.StartInfo.FileName="iexplore.exe";
ps.StartInfo.Arguments=" http://www.caogenit.com";
ps.Start();
- C#在默认浏览器中打开网页
[csharp]
using System.Text.RegularExpressions;
using Microsoft.Win32;
RegistryKey key = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command\");
string s = key.GetValue("").ToString();
Regex reg = new Regex("\"([^\"]+)\"");
MatchCollection matchs = reg.Matches(s);
string filename="";
if (matchs.Count > 0) www.2cto.com
{
filename = matchs[0].Groups[1].Value;
System.Diagnostics.Process.Start(filename, AppUtils.configSetting.WebUri);
}
通过注册表取得默认 浏览器的路径,然后用进程打开即可