Microsoft KB Archive/259100

= SAMPLE: Vbhttp.exe Demonstrates How to Use HTTP WinInet APIs in Visual Basic =

Article ID: 259100

Article Last Modified on 8/11/2004

-

APPLIES TO


 * Microsoft Internet Explorer 4.0 128-Bit Edition
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 4.01 Service Pack 2
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer 5.5
 * Microsoft Windows Internet Services (WinInet)
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 4.0 Enterprise Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q259100



SUMMARY
The Vbhttp.exe file is a sample that demonstrates how to use Win32 Internet (WinInet) HTTP application programming interfaces (APIs) in Visual Basic.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

Download Vbhttp.exe now

For additional information about how to download Microsoft Support Files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

Vbhttp.exe contains the following files:

The sample demonstrates the following concepts:
 * How to use the GET/POST method to send an HTTP/HTTPS request and how to read the response from the server.

This sample uses the same proxy setting in Internet Explorer by passing INTERNET_OPEN_TYPE_PRECONFIG to the InternetOpen function.
 * How to handle proxy/Web server authentication.

This sample calls InternetSetOption (no UI) to set the credential after it detects the 407 (proxy server) or 401 (Web server) status code. To display the built-in logon dialog box in Internet Explorer, call the InternetErrorDlg function instead. For Web server authentication, you can directly pass the user name and password to the InternetConnect function, if you already have them.
 * How to handle invalid certificate authority error (12045).

This sample uses InternetSetOption (no UI) to ignore the error after HttpSendRequest fails. You can use the InternetErrorDlg function (with UI) as well.

