Web Browser prob: won't load an html file that is definately there

  • Thread starter Thread starter SteMc
  • Start date Start date
S

SteMc

Hi,

I'm using vb 2003 and have a browser window. Previsouly I used the
command...
"main_browser.navigate("C:\....\html files\main.html") and the browser
succesfully navigated to the designated html file.

Then I changed it so that it only read...
"main_browser.navigate("html files\main.html") where "html files" is a
sub-folder of the location of the executable file. It now won't work.
I've used an if statement to check that the file exists and the code to
navigate should only occur if the file is found. When stepping through
the code the file is definately found-in fact the file can be opened
with a streamreader and edited! But it won't open in the browser
window.

Anyone know why?

Also, this is the first time I've made an executable version of the
program (I've previously just been running it by pressing F5). When I
ran the .exe file my firewall popped up and told me that the program
was trying to connect to a DNS server! Why on earth would it do that?

Any help would be greatly appreciated,

thanks,

Steve
 
Steve,

The browser recognises the full path as a local path and directly opens it.

The relative path does not give many clues about the url being a local
resource. The browser is looking for your resource on the network, as it
would do if you navigated to www.google.com. That's why it is using the dns
server.

A solution might be to let your code generate a full path. The following code
should do the trick:
----- begin code -----
dim objFile as new system.io.fileinfo("html files\main.html")

main_browser.navigate(objFile.fullname)
----- end code -----

Best regards,

Renze de Waal
 
Back
Top