Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hiya,

I am currently working on an implementation of a local help system with links which are in the following format:

System.Diagnostics.Process.Start("file:///D:/Folder/Default.htm#Product.htm")


However when the user clicks the button which loads this, it only loads up to the # symbol and doesn't show the rest. The path shown in the browser is file:///D:/Folder/Default.htm. I've tried internet links with the # symbol in and they're fine, it's just links to local files which don't work. Can anyone offer an alternative library to use so I can use it in this way?
Posted

1 solution

I can confirm it. At least this is how it works with start issued from the Shell with Mozilla SeaMonkey browser of the most recent version, with Windows 7. It looks like the anchor is ignored.

Interestingly, if I use the Web browser application file directly, it works correctly. For example, this should work:
C#
string browser = //...; path name of the browser application
string commandLine = "file:///D:/Folder/Default.htm#Product.htm";
System.Diagnostics.Process.Start(browser, commandLine);


I do understand that this solution is not very good, because it is not universal, but what you can do if we have such a defect in the Shell (because this example shows that the browser works correctly, so this a kind of defect in the Shell API, not the browser)?

You can improve it using the same code, only you would need to calculate the browser full path name out of the data retrieved from system Registry.

[EDIT]

Use the Registry key:
C#
HKEY_CLASSES_ROOT\http\shell\open\command


Please see:
http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx[^].

See also this CodeProject article:
Read, write and delete from registry with C#[^].

—SA
 
Share this answer
 
v7

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900