473,597 Members | 2,037 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
Jul 22 '05 #1
3 10603
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

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******** ******@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

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.

"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


Jul 22 '05 #4

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

Similar topics

2
2364
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 has a Java applet. This is the only way I am aware of to get a Java applet to paint within a .NET Forms window. Given that scenario I am trying to determine whethere there would be one Java VM loaded for all of the (n) applets inside the (n) MS...
6
2584
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...
1
1920
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
963
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 directory (configurable by user on the web application's screen in user preferences and usually never changed) without prompting use for save as. I also need to be able to download multiple files at once through browser from client's pc without...
0
800
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 then it works fine... document.getElementById("BrowserControl").Navigate("http://server/directory/filename.doc"); However if I add any more code above this line e.g. alert("hello"); I get the following error... 'Microsoft JScript runtime error:...
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
3
2939
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 with the control. I need to change the text to have the correct text for the language chosen.
0
1117
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 help. Yaniv.
2
10354
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...
0
7965
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
8271
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8380
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8031
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
6686
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...
0
5426
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
3881
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3923
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1231
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.