在网址中使用锚点的Process.Start(url)

Ric*_*d B 5 .net url flare madcap

我正在尝试使用Process.Start在默认浏览器中启动本地html文件.

示例网址如下:

"file:///C:/Documentation/HelpContent/default_CSH.htm#SectionA/Topic1.htm"
Run Code Online (Sandbox Code Playgroud)

问题是,"#SectionA/Topic1.htm"位由于某种原因被剥离,因此该信息不会传递给浏览器.但它确实适用于非本地URL.

有谁知道如何让这个工作或是某种预防性的安全问题?

谢谢

Jas*_*aty 4

使用Process.Starton iexplore.exe,以便您可以专门指定 URL 作为其参数:

System.Diagnostics.Process.Start("iexplore.exe", @"file:///c:/dir/file.html#anchor");
Run Code Online (Sandbox Code Playgroud)