473,508 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Local File Links in Web Browser Control

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
Jul 22 '05 #1
3 10597
AHN
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" <wi********@reachdigital.com> wrote in message
news:Om**************@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

Jul 22 '05 #2
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" <an****@excite.com> wrote in message
news:Od**************@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" <wi********@reachdigital.com> wrote in message
news:Om**************@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

Jul 22 '05 #3
AHN
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" <wi********@reachdigital.com> wrote in message
news:OZ**************@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" <an****@excite.com> wrote in message
news:Od**************@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" <wi********@reachdigital.com> wrote in message
news:Om**************@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


Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2349
by: dxben | last post by:
I am considering a situation where I have (n) number of form windows, each with an instance of the Microsoft Web Browser Control (IE) on each form. In each web browser control is an HTML page that...
6
2577
by: Christopher D. Wiederspan | last post by:
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...
1
1916
by: John Boghossian | last post by:
Has anyone successfully used the file upload activex control. It would be nice to hear of any practical experiences. I tried to get it working, but I didn´t succeed. Regards John
0
959
by: Igor | last post by:
I need to implement the following download functionality in the browser. When users request a certain operation from the web application, certain files are downloaded to their PCs, into a certain...
0
796
by: MP74 | last post by:
I'm trying to open a word.doc in a web form using a Microsoft Web Browser control. If I write a small project which simply executes the following line of code inside a script block in the HTML...
0
1326
by: news.austin.rr.com | last post by:
hi i am using the miscrosoft browser control on a windows form (win form) to extract html content to a local html file. I use the browser control and mshtml.IHTMLDocument2 as shown below. ...
3
2931
by: Olivier Verdin | last post by:
Hi, I am developing a multi-language application in ASP.NET in c#. I am using a file field html control to upload an image. I would like to change the text on the button "browse" that comes...
0
1110
by: Yaniv M | last post by:
Hi Im using the microsoft web browser control to create a simple like browser. I want to disable the cookies for the browser when used but i dont know how to do it from within the code. please...
2
10315
by: Lyle Fairfield | last post by:
I am using Microsoft’s Web Browser Control embedded on an Access Form to browse a specific site. I have a good reason for doing so; the pages on this site run code which aborts their display unless...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.