473,664 Members | 3,035 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\S omeFile.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="\\MyMachi ne\Temp\SomeFil e.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 2586
AHN
First, you shouldn't crosspost.

Next, in your <A>, try 'href="file://C:\Temp\SomeFil e.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. :)
"Christophe r D. Wiederspan" <wi********@rea chdigital.com> wrote in message
news:Om******** ******@TK2MSFTN GP10.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\S omeFile.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="\\MyMachi ne\Temp\SomeFil e.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\SomeFil e.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. :)
"Christophe r D. Wiederspan" <wi********@rea chdigital.com> wrote in message
news:Om******** ******@TK2MSFTN GP10.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\S omeFile.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="\\MyMachi ne\Temp\SomeFil e.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******** ******@TK2MSFTN GP15.phx.gbl...
First, you shouldn't crosspost.

Next, in your <A>, try 'href="file://C:\Temp\SomeFil e.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. :)
"Christophe r D. Wiederspan" <wi********@rea chdigital.com> wrote in message
news:Om******** ******@TK2MSFTN GP10.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\S omeFile.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="\\MyMachi ne\Temp\SomeFil e.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******** ******@TK2MSFTN GP15.phx.gbl...
First, you shouldn't crosspost.

Next, in your <A>, try 'href="file://C:\Temp\SomeFil e.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. :)
"Christophe r D. Wiederspan" <wi********@rea chdigital.com> wrote in message
news:Om******** ******@TK2MSFTN GP10.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\S omeFile.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="\\MyMachi ne\Temp\SomeFil e.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.

"Christophe r D. Wiederspan" <wi********@rea chdigital.com> wrote in message
news:OZ******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP15.phx.gbl...
First, you shouldn't crosspost.

Next, in your <A>, try 'href="file://C:\Temp\SomeFil e.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. :)
"Christophe r D. Wiederspan" <wi********@rea chdigital.com> wrote in message
news:Om******** ******@TK2MSFTN GP10.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\S omeFile.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="\\MyMachi ne\Temp\SomeFil e.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.

"Christophe r D. Wiederspan" <wi********@rea chdigital.com> wrote in message
news:OZ******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP15.phx.gbl...
First, you shouldn't crosspost.

Next, in your <A>, try 'href="file://C:\Temp\SomeFil e.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. :)
"Christophe r D. Wiederspan" <wi********@rea chdigital.com> wrote in message
news:Om******** ******@TK2MSFTN GP10.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\S omeFile.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="\\MyMachi ne\Temp\SomeFil e.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
10604
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 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...
0
1329
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. mshtml.IHTMLDocument2 doc = axWebBrowser1.Document as mshtml.IHTMLDocument2; using the doc object I can have this code
15
4753
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 button will verify the information that has been entered and updates the data base if the data is correct. Update will throw an exception if the data is not validate based on some given rules. I also have a custom error handling page to show the...
1
2747
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 pictures or music, etc. Which worked fine, I created the code to do that and to store the results in a mysql database. I can even print it out to a ..php page and sort it however I like. What I can't seem to do is to create links to the data...
6
4908
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 loaded into a new browser window. This works as expected on the test PC (using forms authentication, but no SSL) using IE. It also works as expected on the production server when using FireFox. The production server environment is using forms...
2
10371
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 their window is the top window; they also treat all child windows as not-logged in windows. So I have not accomplished what I want with HTA’s or IFrames or Pop-Up Windows. But the Access Form/MS Web Browser combination gives me a top window with...
53
4654
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, and .Net2005 code. I'm developing in vb.net 2005. This test sub just reads an input text file, writing out records to another text file, eliminating records that have a '99' in them (it is similar to a CSV file). Some of my concerns are:
7
2634
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 them in a browser doesn't take me to the file link. I have found examples for clickable URL's, FTP links and mailto addresses but not files. I am managing to produce output like this: <a...
0
1148
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 some post message to corresponding URL.Then I will get response string. In response string i am go to create one .HTML extension file.Then I am using AxWebBrowser Class Create Object .Then I am using this object ...
0
1113
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 networked file-systems. It has been proposed that rather than creating a web- repository for python eggs we store these on a local file-server. Has anybody had any luck using the --find_options argument to easy_install with a local folder (e.g....
0
8437
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8348
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8549
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2764
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 we have to send another system

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.