Possible Duplicate:
Opening html file with query string
我正在使用 C# 编写一个简单的控制台应用程序,并且尝试使用“name”参数打开本地 html 文件。现在我正在使用 const url (用于测试...): “文件:///D:/index.html?name=bob”
代码很简单:
class Program
{
static void Main(string[] args)
{
string link = @"file:///D:/index.html?name=bob";
Process.Start(link);
}
}
但它会打开浏览器并显示链接:“file:///D:/index.html”。 有谁知道为什么它省略“name”参数以及如何修复它?
谢谢!
最佳答案
如果您不介意绑定(bind)到特定浏览器(而不是系统中定义的浏览器),则可以使用以下方法:
Process.Start("iexplore.exe", @"file:///D:/index.html?name=bob")
否则我猜您可以推断出关联的程序(可能通过 registry )并采用相同的技术。
关于c# - Process.Start(link) 省略部分链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13550837/