Вопрос

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!

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top