SAMPLE: Vbhttp.exe Demonstrates How to Use HTTP WinInet APIs in Visual Basic (259100)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 4.0
  • Microsoft Internet Explorer (Programming) 4.01
  • Microsoft Internet Explorer (Programming) 4.01 SP1
  • Microsoft Internet Explorer (Programming) 4.01 SP2
  • Microsoft Internet Explorer (Programming) 5
  • Microsoft Internet Explorer (Programming) 5.01
  • Microsoft Internet Explorer (Programming) 5.5
  • Microsoft Windows Internet Services (WinInet)
  • Microsoft Visual Basic Professional Edition for Windows 4.0
  • Microsoft Visual Basic Professional Edition for Windows 5.0
  • Microsoft Visual Basic Professional Edition for Windows 6.0
  • Microsoft Visual Basic Enterprise Edition for Windows 4.0
  • Microsoft Visual Basic Enterprise Edition for Windows 5.0
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0

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:
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:

File nameSize
EULA.txt1610
Http.frm37900
Http.txt71
Mssccprj.scc191
Vbhttp.vbp796
Vbhttp.vbw89
WinInet.bas6150


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.

REFERENCES

For a list of all WinInet APIs, see the following MSDN Web Workshop site (click Win32 Internet Functions in the left frame): For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:

165298 HOWTO: Simulate a Form POST Request Using WinInet

195650 HOWTO: Handle Proxy Authorization with WinInet

254396 PRB: Cannot Connect Through Proxy Server that Requires NTLM Authentication

168151 HOWTO: Make SSL Requests Using WinInet

182888 HOWTO: Handle Invalid Certificate Authority Error with WinInet

193625 WinInet Error Codes (12001 through 12156)

185519 FILE: Vbinet.exe WinInet API Declarations for Visual Basic

175179 FILE: VBFTP.EXE: Implementing FTP Using WinInet API from VB

195653 SAMPLTE: Using FTP WinInet APIs in Visual Basic with SimpleFtp


Modification Type:MinorLast Reviewed:8/11/2004
Keywords:kbdownload kbFTP kbhowto kbhttp KB259100