472,799 Members | 1,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,799 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 2550
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: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.