Jeroen,

Based on your sample code snipit, System.Diagnostics.Process.Start
(@"c:\mypage.html");, just remeber that good old IE will
take "C:\mypage.html#anchorName" in the Process.StartInfo.Arguments
property.  But if your lauching those other browsers like Mozilla you
cannot.  If you are attemping to launch a local file you should use the
file:// sytax, "file://C:/mypage.html#anchorName".  Also, your original
problem would have been solved had you coded,
System.Diagnostics.Process.Start(@"file://c:/mypage.html#anchorName");.
But like Joakim indicated, you don't want to shell to the file directly
because you could get an HTML editor.

Chad

On Thu, 17 Jun 2004 15:09:46 +0200, Jeroen van den Bos (DT)
<[EMAIL PROTECTED]> wrote:

>Thanks for the link, saves me some time :)
>
>-Jeroen
>
>-----Original Message-----
>From: Unmoderated discussion of advanced .NET topics.
>[mailto:[EMAIL PROTECTED] On Behalf Of Joakim
>Karlsson
>Sent: donderdag 17 juni 2004 14:44
>To: [EMAIL PROTECTED]
>Subject: Re: [ADVANCED-DOTNET] launching an html page with an anchor
>
>Yeah, you must do some trimming. The command line stored in the registry
>might contain any kind of parameters (and even 8.3 path names).
>
>This article contains an example:
>http://ryanfarley.com/blog/archive/2004/05/16/649.aspx
>
>/Joakim
>
>----- Original Message -----
>From: "Jeroen van den Bos (DT)" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, June 17, 2004 2:35 PM
>Subject: Re: [ADVANCED-DOTNET] launching an html page with an anchor
>
>
>Joakim,
>
>Thanks for that tip! And since the KB specifically instructs to use that
>key to retrieve the default browser I suppose I'd better use it.
>
>The only thing that annoys me here is that my entry has the following
>value in that key:
>
>"C:\Program Files\Internet Explorer\iexplore.exe" -nohome
>
>which, if you send it to System.Diagnostics.Process.Start(), throws an
>exception because it doesn't understand the parameter (the string should
>probably contain only the location of an executable and nothing more, it
>probably doesn't parse anything like cmd does) so I guess I'll have to
>do some trimming/regexping :(
>
>And concatenating this value and the link and sending everything to
>cmd.exe is probably considered dirty as well :)
>
>-Jeroen
>
>-----Original Message-----
>From: Unmoderated discussion of advanced .NET topics.
>[mailto:[EMAIL PROTECTED] On Behalf Of Joakim
>Karlsson
>Sent: donderdag 17 juni 2004 13:54
>To: [EMAIL PROTECTED]
>Subject: Re: [ADVANCED-DOTNET] launching an html page with an anchor
>
>Jeroen,
>
>Actually you should check "HKCR\http\shell\open\command". Checking html
>or
>htmlfile might give you a html editor instead.
>
>Check out the following KB article:
>http://support.microsoft.com/default.aspx?scid=kb;en-us;283225%22
>
>/Joakim
>
>----- Original Message -----
>From: "Jeroen van den Bos (DT)" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, June 17, 2004 7:36 AM
>Subject: [ADVANCED-DOTNET] launching an html page with an anchor
>
>
>Hi all,
>
>I'm trying have my application launch an html page with a certain anchor
>as a parameter. I want to launch the default webbrowser, so just for an
>html page I would do (c#):
>
>System.Diagnostics.Process.Start(@"c:\mypage.html");
>
>Unfortunately this doesn't work if I want to launch
>c:\mypage.html#someanchor.
>
>I've tried figuring out where to find an executable path to the system's
>default browser, but the only thing I could find was a registry
>reference (HKEY_CLASSES_ROOT\htmlfile\shell\open\command), but I'm not
>entirely sure if I want to/can depend on that information being
>available and appropriate on every user's machine.
>
>Thanks in advance for any ideas!
>-Jeroen
>
>===================================
>This list is hosted by DevelopMentor(r)  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
>http://discuss.develop.com
>
>===================================
>This list is hosted by DevelopMentor(r)  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
>http://discuss.develop.com
>
>===================================
>This list is hosted by DevelopMentor(r)  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
>http://discuss.develop.com
>
>===================================
>This list is hosted by DevelopMentor(r)  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
>http://discuss.develop.com
>
>===================================
>This list is hosted by DevelopMentorŪ  http://www.develop.com
>Some .NET courses you may be interested in:
>
>NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
>http://www.develop.com/courses/gaspdotnetls
>
>View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to