Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect 404 in browser control

Status
Not open for further replies.

WiseNewbie

Programmer
Jan 9, 2004
45
0
0
AU
Hey,

Is there a simpler way of detecting a 404 error page occuring inside the WebBrowser control? At the moment i check to make sure the file exists before i browse the page. As you may have figured out this cant work for URLs outside the system. What method/property/function should one use to detect it then?

Thanks!

~ Emily
 
you could use the inet control to return the source for the page you are trying to view. If the source matches the 404 error page, then the page does not exist.

BB
 
Doesn't seem like that will work, not every 404 page is the exactly the same html wise.

Also if DNS just plain fails you don't get a 404 back. You get the Page not avialable like if a site was just down.

I think what you want to look at for the Web Browser is

WebBrowser.Body.InnerText

For 404 it seems like 404 is always the first 3 characters. I think that much may be RFC defined but after that it can be different.

For a DNS failure that is something like "Page not Available" and since IE puts that there it should be always the same.

 
thanks:) i'll look into these, can we get to the headers of the page request within the IE browser?

that way there may be a sure wya of telling if it was a 404 or not:)

~ Emily
 

check the wb.status

BTW WiseNewbie have you read FAQ222-2244 yet?

Good Luck

 

WiseNewbie have you read FAQ222-2244 yet? Did the status of the webbrowser solve your problem?

Good Luck

 
hi guys,

i read the FAQ, unfortunetly no it didnt solve my problem...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top