Solved

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

Posted on 2004-03-25
1
465 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

623 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