问题
Possible Duplicate:
Opening html file with query string
I'm writing a simple console app using c# and I'm trying to open a local html file with "name" parameter. For now I'm using const url (For testing...): "file:///D:/index.html?name=bob"
The code is simple:
class Program
{
static void Main(string[] args)
{
string link = @"file:///D:/index.html?name=bob";
Process.Start(link);
}
}
But it opens the browser with the link: "file:///D:/index.html". Do anyone knows why does it omit the 'name' parameter and how to fix it?
Thanks!
回答1:
If you don't mind binding to a specific browser (rather than the one defined in the system), this works:
Process.Start("iexplore.exe", @"file:///D:/index.html?name=bob")
Otherwise I'm guessing you could deduce the associated program (probably via the registry) and employ the same technique.
来源:https://stackoverflow.com/questions/13550837/process-startlink-omits-part-of-the-link