Process.Start(link) omits part of the link [duplicate]

无人久伴 提交于 2019-12-02 02:18:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!