473,396 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
Nov 17 '05 #1
6 2573
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

Nov 17 '05 #2
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

Nov 17 '05 #3
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

Nov 17 '05 #4
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

Nov 17 '05 #5
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


Nov 17 '05 #6
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


Nov 17 '05 #7

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

Similar topics

3
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...
0
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. ...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
1
by: Matt Walker | last post by:
I decided to flesh out my php skills by building a web application which could scan through local files on my intranet (specifically mapped drives on my server) and generate a list of Movies or...
6
by: Alec MacLean | last post by:
Hi, I've created a small application for our company extranet (staff bulletins) that outputs a list of links to PDF's that are stored in a SQL table. The user clicks a link and the PDF is...
2
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...
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
7
by: Jeff Gaines | last post by:
I have spent the day learning how to use Zend Development Environment. I can now produce a list of files in a directory, filtered by extension, and apparently clickable. Unfortunately clicking on...
0
by: thirunavukarasukm | last post by:
Hai. I created one windows application.I am add reference control to add Microsoft WebBrowser Control..In my application I am using HTTPWebRequest and HttpWebResponse class .To request...
0
by: Salim Fadhley | last post by:
A project I'm working on requires a Python egg to be deployed to a remote location which (because of a security configuration outside my control) denies users web-access but allows users access to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.