I need to open an html file from the program root directory and have it jump to a specified anchor. I can open the file perfectly fine with a simple
System.Diagnostics.Process.Start(“site.html”)
but as soon as I try to add the anchor to the end it ceases to be able to find the file.
I was able to put the anchor in there and still have it launch with
string Anchor
Anchor = “file:///” + Environment.CurrentDirectory.ToString().Replace(“\”, “/”) +
“/site.html#Anchor”;
System.Diagnostics.Process.Start(Anchor);
However as soon as the browser launches it drops the anchor. Any suggestions?
You may need to enclose the entire URL in quotation marks to preserve any special characters (such as the #) or spaces.
Try: