Solved

How to capture HTTP server return codes using the webbrowser control with Visual Basic

Posted on 2004-03-25
1
456 Views
Last Modified: 2008-02-01
I'm creating a program in Visual Basic that will launch a particular URL.  I need to be able to receive and act upon HTTP server messages.  For example I may want to capture and act upon HTTP error 500 - Bad script request or HTTP error 404.

The StatusTextChange event does fire with each status text change and I can see things like:

Start download from site: res://C:\WINDOWS\SYSTEM\SHDOCLC.DLL/http_500.htm
Downloading from site: res://C:\WINDOWS\SYSTEM\SHDOCLC.DLL/http_500.htm

I suppose I could parse these text messages looking for "http_500", "http_404", etc but I'm wondering if there's a more direct way?

0
Comment
Question by:mskvarenina
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 125 total points
ID: 10704845

There must be a Property of the webbrowser which gives the server status code

 in webbrowser Control there is an event called NavigateError is triigered
   
  with this usage

   Private Sub object_NavigateError( _
      ByVal pDisp As Object, _
      ByVal URL As Variant, _
      ByVal TargetFrameName As Variant, _
      ByVal StatusCode As Variant, _
      ByRef Cancel As Boolean)

   In the status code parametre u ll get the Statsu codes that ll be listed at the fallowing Url

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/act/htm/actml_ref_hsco.asp

Hope it helpss
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Web Easy Professional 10 Embedded Facebook 1 69
DNS Forward 4 64
Short term mitigation for Symantec's certs (Google's downgrading) 2 70
PDF Turn Look 7 34
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question