Microsoft KB Archive/259100

From BetaArchive Wiki
Knowledge Base


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:

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 name Size
EULA.txt 1610
Http.frm 37900
Http.txt 71
Mssccprj.scc 191
Vbhttp.vbp 796
Vbhttp.vbw 89
WinInet.bas 6150



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



Additional query words: Vbhttp

Keywords: kbhowto kbdownload kbhttp kbftp KB259100