I've got a WebBrowser control in a C# Windows form. I build HTML on the fly
and then set it into the control using the DocumentText property of the
control. All of this works fine, except that part of the HTML that I
construct is an <A> element that links to a local file, something like this:

<A HREF="C:\Temp\SomeFile.htm" TARGET="_blank">Test</A>

When I click on the link in the browser control, nothing happens.

After some experimentation, I've learned that if I share my Temp directory
and then use this HTML instead, it works:

<A HREF="\\MyMachine\Temp\SomeFile.htm" TARGET="_blank">Test</A>

Can anybody give me some insight into this - I'm stuck without having the
ability to link up to local files.

Thanks,
Chris

Re: Using Local File Links in Web Browser Control by AHN

AHN
Fri Jul 22 16:42:31 CDT 2005

First, you shouldn't crosspost.

Next, in your <A>, try 'href="file://C:\Temp\SomeFile.htm"'. The other link
works probably because it is being treated like a web-link with your
machine's server as the root. Again it's not correct. It shouldn't work. I
don't like it, but never mind. :)


"Christopher D. Wiederspan" <wiederspan@reachdigital.com> wrote in message
news:OmmCNMwjFHA.1480@TK2MSFTNGP10.phx.gbl...
I've got a WebBrowser control in a C# Windows form. I build HTML on the fly
and then set it into the control using the DocumentText property of the
control. All of this works fine, except that part of the HTML that I
construct is an <A> element that links to a local file, something like this:

<A HREF="C:\Temp\SomeFile.htm" TARGET="_blank">Test</A>

When I click on the link in the browser control, nothing happens.

After some experimentation, I've learned that if I share my Temp directory
and then use this HTML instead, it works:

<A HREF="\\MyMachine\Temp\SomeFile.htm" TARGET="_blank">Test</A>

Can anybody give me some insight into this - I'm stuck without having the
ability to link up to local files.

Thanks,
Chris




Re: Using Local File Links in Web Browser Control by Christopher

Christopher
Fri Jul 22 16:48:46 CDT 2005

Yes, I tried everything I could thing of to come up with different paths and
even prepending the "file://" onto the front didn't help.

Any other ideas?

Chris

"AHN" <anerse@excite.com> wrote in message
news:Odt2HZwjFHA.1232@TK2MSFTNGP15.phx.gbl...

> First, you shouldn't crosspost.
>
> Next, in your <A>, try 'href="file://C:\Temp\SomeFile.htm"'. The other
> link
> works probably because it is being treated like a web-link with your
> machine's server as the root. Again it's not correct. It shouldn't work. I
> don't like it, but never mind. :)
>
>
> "Christopher D. Wiederspan" <wiederspan@reachdigital.com> wrote in message
> news:OmmCNMwjFHA.1480@TK2MSFTNGP10.phx.gbl...
> I've got a WebBrowser control in a C# Windows form. I build HTML on the
> fly
> and then set it into the control using the DocumentText property of the
> control. All of this works fine, except that part of the HTML that I
> construct is an <A> element that links to a local file, something like
> this:
>
> <A HREF="C:\Temp\SomeFile.htm" TARGET="_blank">Test</A>
>
> When I click on the link in the browser control, nothing happens.
>
> After some experimentation, I've learned that if I share my Temp directory
> and then use this HTML instead, it works:
>
> <A HREF="\\MyMachine\Temp\SomeFile.htm" TARGET="_blank">Test</A>
>
> Can anybody give me some insight into this - I'm stuck without having the
> ability to link up to local files.
>
> Thanks,
> Chris
>
>
>



Re: Using Local File Links in Web Browser Control by AHN

AHN
Fri Jul 22 17:10:23 CDT 2005

Doubleclick on your inserted htm file to open it with IE (or whatever your
default browser is). Click on Test. Does a new instance of the browser
appear with SomeFile.htm or not? If yes, pay attention how you load the file
into the webcontrol. If no, check your html.

"Christopher D. Wiederspan" <wiederspan@reachdigital.com> wrote in message
news:OZF3lcwjFHA.2920@TK2MSFTNGP14.phx.gbl...
Yes, I tried everything I could thing of to come up with different paths and
even prepending the "file://" onto the front didn't help.

Any other ideas?

Chris

"AHN" <anerse@excite.com> wrote in message
news:Odt2HZwjFHA.1232@TK2MSFTNGP15.phx.gbl...

> First, you shouldn't crosspost.
>
> Next, in your <A>, try 'href="file://C:\Temp\SomeFile.htm"'. The other
> link
> works probably because it is being treated like a web-link with your
> machine's server as the root. Again it's not correct. It shouldn't work. I
> don't like it, but never mind. :)
>
>
> "Christopher D. Wiederspan" <wiederspan@reachdigital.com> wrote in message
> news:OmmCNMwjFHA.1480@TK2MSFTNGP10.phx.gbl...
> I've got a WebBrowser control in a C# Windows form. I build HTML on the
> fly
> and then set it into the control using the DocumentText property of the
> control. All of this works fine, except that part of the HTML that I
> construct is an <A> element that links to a local file, something like
> this:
>
> <A HREF="C:\Temp\SomeFile.htm" TARGET="_blank">Test</A>
>
> When I click on the link in the browser control, nothing happens.
>
> After some experimentation, I've learned that if I share my Temp directory
> and then use this HTML instead, it works:
>
> <A HREF="\\MyMachine\Temp\SomeFile.htm" TARGET="_blank">Test</A>
>
> Can anybody give me some insight into this - I'm stuck without having the
> ability to link up to local files.
>
> Thanks,
> Chris
>
>
>