PDA

Click to See Complete Forum and Search --> : : How do i get to HTTP Source from a VB Application?


ramcha_72
Nov 17th, 1999, 08:24 PM
I have a ISAPI server extension to which i need to submit data (HTML form submit or through the query string). The problem is that the ISAPI extension dll's response is not in the standard HTML format (it returns pure XML). I am doing the post through the Navigate method of an Internet Browser Control Object from one of my VB forms and after the post, when i do a BrowserControl.document.body.outerHTML i do not get the entire response block back. i.e., the response from the DLL is not completely retrieved by the call to the outerHTML.
Please see the following code for clarity:

Private Function SubmitToDll(sHTTPReq as string)

frmBrowser.WebBrowser1.Navigate (sHTTPReq)
While Not m_bDocLoaded
DoEvents
Wend
m_bDocLoaded = False
MsgBox frmBrowser.WebBrowser1.Document.body.outerHTML

End Function

The Document complete event is trapped for the browser control to notify the rest of the program that the said document has completed loading.

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
m_bDocLoaded = True
End Sub

Let us say the message box in the first function returns something like this :
"234</TAG2><TAG3>ABCD<TAG3></TAG1>"

When i do a 'view source' by right clicking on the browser control what i actually see is something like this :
"<TAG1 id='a'></TAG1><TAG2>234</TAG2><TAG3>ABCD<TAG3></TAG1>"

What is happening here is that since the response from the dll is not in the HTML format, the browser control inserts a <BODY> tag just before the first displayable text it finds in the response, Which in this case is the text '234'. It ignores all the tags it does not understand - <TAG1 id='a'></TAG1><TAG2>. Therefore in the DocumentObjectModel, the 'body' element will contain all the text from this '234' till the end i.e., </TAG1>. So, when i do document.body.outerHTML i get only this stripped version of the response and the text before (<TAG1 id='a'> </TAG1><TAG2> ) is lost.

My questions are :

1. Is there a way around it? i.e., is there some method/property which will allow me to get to the source of the HTML page without using the DocumentObjectModel calls (document.body etc).

2. Is there another browser control which i can use in my form which will let me get to the source of the page that is currently loaded in the control without using the DOM?

I have been stopped in my tracks for almost a week now because of this and any suggestion/help would be greatly appreciated.

-Krishnan, Ramachandran

PS: I have posted this in the forum for Internet Development too.