Article ID: 256195 - Last Review: May 11, 2006 - Revision: 3.0 How To Handle Data from a Post Form When Hosting WebBrowser ControlThis article was previously published under Q256195 On This PageSUMMARY When you want to retrieve data from a POST form in Active
Server Pages (ASP) pages, you can use the Request.Form collection. However,
when hosting a WebBrowser control, there is no direct method to retrieve the
data. You must do some conversion in the application. This article demonstrates how to retrieve data as a string from a POST in a Microsoft Visual Basic and Visual C++ WebBrowser control application. This article assumes you have knowledge of hosting the WebBrowser control and sink events with it. MORE INFORMATION You could retrieve data sent on an html page at the
BeforeNavigate2 event of the WebBrowser control before the data is sent to the
Web server. When an html form uses the GET method, the data are simply
retrieved from the URL argument. However, when an html form uses the POST
method, the data are not associated with the URL, but you can access them via
the PostData argument. The URL argument contains a string in Visual Basic (or a variant pointer to a BSTR in Visual C++). So you could directly access GET data from the URL argument. On the other hand, the PostData argument contains a SafeArray Bytes (or a variant pointer to a SAFEARRAY in Visual C++). So some conversion is necessary to retrieve the data. The following code segments show how this is done. In Visual BasicIn Visual C++REFERENCES For a Microsoft Visual Basic .NET version of this
article, see
311294
(http://support.microsoft.com/kb/311294/EN-US/
)
. For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:http://msdn.microsoft.com/ie/
(http://msdn.microsoft.com/ie/)
For additional
information, click the article number below to view the article in the
Microsoft Knowledge Base: http://support.microsoft.com/iep (http://support.microsoft.com/iep) 167658
(http://support.microsoft.com/kb/167658/EN-US/
)
How To Automate Internet Explorer to POST Form Data
APPLIES TO
| Article Translations
|

Back to the top
