473,651 Members | 2,750 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web Browser control - how to navigate to a local file.

I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:

string path = Path.GetDirecto ryName(
Assembly.GetExe cutingAssembly( ).GetModules()
[0].FullyQualified Name) +
"\\howdoi.h tm";
webBrowser1.Nav igate(path);

What do I need to do to form the correct URI string for a local file?

Thanks.

Sep 20 '07 #1
5 23431
Once you get the assembly for the executing assembly, you will want to
use the Location property on the assembly to get the directory that the
assembly is in.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<ti*****@gmail. comwrote in message
news:11******** **************@ 19g2000hsx.goog legroups.com...
>I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:

string path = Path.GetDirecto ryName(
Assembly.GetExe cutingAssembly( ).GetModules()
[0].FullyQualified Name) +
"\\howdoi.h tm";
webBrowser1.Nav igate(path);

What do I need to do to form the correct URI string for a local file?

Thanks.

Sep 20 '07 #2
On Sep 20, 9:56 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
Once you get the assembly for the executing assembly, you will want to
use the Location property on the assembly to get the directory that the
assembly is in.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om

<timn...@gmail. comwrote in message

news:11******** **************@ 19g2000hsx.goog legroups.com...
I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:
string path = Path.GetDirecto ryName(
Assembly.GetExe cutingAssembly( ).GetModules()
[0].FullyQualified Name) +
"\\howdoi.h tm";
webBrowser1.Nav igate(path);
What do I need to do to form the correct URI string for a local file?
Thanks.
Thanks but the path comes out as C:\....\howdo.i htm which is the
correct file name, but the Navigate method displays page not found
type error. Let's say I wanted to navigate to a local file C:\temp
\text.html.... what would I pass to navigate ?

Sep 20 '07 #3
When you call navigate, it should take a file name just fine and
navigate to it. It it doesn't, then there is something else wrong (perhaps
the file name is wrong).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<ti*****@gmail. comwrote in message
news:11******** **************@ r29g2000hsg.goo glegroups.com.. .
On Sep 20, 9:56 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
> Once you get the assembly for the executing assembly, you will want
to
use the Location property on the assembly to get the directory that the
assembly is in.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om

<timn...@gmail .comwrote in message

news:11******* *************** @19g2000hsx.goo glegroups.com.. .
>I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:
string path = Path.GetDirecto ryName(
Assembly.GetExe cutingAssembly( ).GetModules()
[0].FullyQualified Name) +
"\\howdoi.h tm";
webBrowser1.Nav igate(path);
What do I need to do to form the correct URI string for a local file?
Thanks.

Thanks but the path comes out as C:\....\howdo.i htm which is the
correct file name, but the Navigate method displays page not found
type error. Let's say I wanted to navigate to a local file C:\temp
\text.html.... what would I pass to navigate ?

Sep 20 '07 #4
Hi.
Thanks.

Thanks but the path comes out as C:\....\howdo.i htm which is the
correct file name, but the Navigate method displays page not found
type error. Let's say I wanted to navigate to a local file C:\temp
\text.html.... what would I pass to navigate ?
Try it with IE, maybe you should use file://c:\......
Sep 20 '07 #5
On Sep 20, 10:21 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
When you call navigate, it should take a file name just fine and
navigate to it. It it doesn't, then there is something else wrong (perhaps
the file name is wrong).

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om

<timn...@gmail. comwrote in message

news:11******** **************@ r29g2000hsg.goo glegroups.com.. .
On Sep 20, 9:56 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
Once you get the assembly for the executing assembly, you will want
to
use the Location property on the assembly to get the directory that the
assembly is in.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om
<timn...@gmail. comwrote in message
>news:11******* *************** @19g2000hsx.goo glegroups.com.. .
I have a web browser control that I'd like to point at a HTML file in
my installation directory. I am doing something like:
string path = Path.GetDirecto ryName(
Assembly.GetExe cutingAssembly( ).GetModules()
[0].FullyQualified Name) +
"\\howdoi.h tm";
webBrowser1.Nav igate(path);
What do I need to do to form the correct URI string for a local file?
Thanks.
Thanks but the path comes out as C:\....\howdo.i htm which is the
correct file name, but the Navigate method displays page not found
type error. Let's say I wanted to navigate to a local file C:\temp
\text.html.... what would I pass to navigate ?
Sorry, the file name was so long I missed a character I had mistyped.
Sorry to bother you.

Sep 20 '07 #6

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

Similar topics

3
15098
by: Tom Meuzelaar | last post by:
Hello: I'm using VB6 in VS enterprise. I'd like to place an HTML form inside a VB container, have a user fill out the form information, click a submit button, and then have the program capture the field values and write them to an ASCII file on the hard drive. Can anyone confirm that this is even possible? I have dredged up one article "Accessing the Internet Explorer Document Object Model from Visual Basic 5.0" (Asmi, 1998) that covers...
20
1985
by: Steve | last post by:
I have a web app that needs to parse through a file that is located on the client machine. I get the file string from a query string & then parse it. It is working fine on my development box but when I put it out on the test server the application is looking for the file on the server & not on the client machine. I am essentially taking the query string & using a stream reader to read the file. I'm sure i'm doing something...
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
1587
by: Grant | last post by:
I have an application written in c# using the Web Browser Control. I also created a setup package to distribute this application on various machines all running windows xp or 2000. When i distribute the app, i am asked to install the .net framework, once installed the app runs. When i try to navigate to a web site using the Navigate fuction on the control, nothing happens. If i install .net studio on the machine, everything works fine.
0
885
by: Khalilskp | last post by:
I have used wbe browser control in my project. I place two web browser control on two different froms. I want to login on a site by giving two user name and password. when i give login name and password on first form i logs in success fully but when i open second form and give different user name and password the results are unexpacted, it goes to first loged user page and con not login with different user name. I also set flages values in...
1
1634
by: PJSimon | last post by:
I have a VB.Net form with a Microsoft Web Browser control in it. I navigate to an XML file on my computer, then I change the XML document , then I navigate to the XML file again. The browser control shows the OLD XML document. How do I refresh the control to show the new document? Is there a way to clear the control's web cache? THANK YOU!
2
2682
by: samp | last post by:
Hi All, How can i download files using web browser control? I want to be able to automtaically download files giving the file a location and name. I am getting the download file dialog box which i do not want to display. Is there a way to click "Save" programatically? Any help is highly appreciated. I found many posts here for the same question but no answers. SK
2
10368
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...
1
3045
by: celoftis | last post by:
BACKGROUND: I have some PPT slides that have been converted to HTM (ensuring that the show slide animations while browsing checkbox is checked). The original HTM slides have custom animations to allow movie (wmv) playback on mouse click. (All animations have been verified to work when viewing slides in ppt.) Further, I have ensured that the converted HTM file(s) contain only relative file paths. SITUATION #1 When I open the converted...
0
8275
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,...
0
8802
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
8579
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
7297
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
4144
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
4283
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2699
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
1
1909
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1587
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.