PDA

Click to See Complete Forum and Search --> : WebBrowser headers?!?


cougasoft
Sep 22nd, 2000, 08:27 PM
Hello, I was wondering if it is at all possible to get the headers from a loaded url using the WebBrowser control? I am writing a program in vb6 and basically, although the control lets you know that the document is complete etc... I want to know if the page existed, whether it was an internal server error and so on.

At the moment if the file I am attempting to load doesn't exist, the rest of the program becomes useless because I can't check the header, or check whatever it is I need to check to see if it was a 404, 200 etc... It would be nice to say send a message box and handle the error accordingly.

I am really struggling here, read tons of stuff but can't seem to put my finger on how to get the headers from a loaded document. Any help would be really appreciated!


-Paul

Sep 23rd, 2000, 12:48 AM
Take a look at this thread (http://forums.vb-world.net/showthread.php?threadid=31239).

To get headers, use the Inet Control:

Private Sub Inet1_StateChanged(ByVal State As Integer)
On Error Resume Next
Select Case State
Case 3
Timer1.Enabled = True
End Select
End Sub

Private Sub Timer1_Timer()
Dim h
If Inet1.StillExecuting = False Then
h = Inet1.GetHeader
If Not h = "" Then
Text1.Text = Text1.Text & h
Timer1.Enabled = False
Inet1.Cancel
End If
End If
End Sub