Article ID: 216214 - Last Review: August 5, 2004 - Revision: 3.2 SAMPLE: FTP with CERN-Based Password Protected Proxy Using WinInetThis article was previously published under Q216214 On This PageSUMMARY
ProxyFtp.exe is a sample that demontrates how to use the InternetOpenUrl WinInet API to send an FTP request through an HTTP type (that is, CERN) proxy that may require user authentication.
MORE INFORMATIONThe following file is available for download from the Microsoft Download Center: ProxyFtp.exe
(http://download.microsoft.com/download/ie4095/proxyftp/1/w9xnt4/en-us/proxyftp.exe)
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
(http://support.microsoft.com/kb/119591/EN-US/
)
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.
WinInet uses the HTTP protocol to communicate with a proxy, but then the proxy connects to the FTP server via FTP protocol. This fact makes it impossible to use specific WinInet FTP APIs such as FtpOpenFile and FtpPutFile.
However, it is still possible to obtain a directory listing of the FTP server and download files using InternetOpenUrl. This protocol-independent API is capable of taking both an FTP URL, such as ftp://server, or an HTTP URL, such as http://server. Under certain conditions, in addition to the FTP server requiring a set of credentials (that is, the user name and password), the proxy server may require a separate set of credentials. With InternetOpenUrl the user name and password required by the FTP server may be include in the URL, like this: Note This syntax is invalid for HTTP and does not allow a password to be included with the "@" sign. If you do not specify the FTP user name and password in the URL, the proxy accesses the server with user "Anonymous" and some sort of generic password (for example, Microsoft Proxy uses "proxyuser@microsoft.com" as the password). The technique below outlines steps that can be used to handle proxy authentication. In other words it explains how to submit a second set of credentials for the proxy itself.
Notes
How to Run the SampleThe sample uses the INTERNET_OPEN_TYPE_PRECONFIG Internet access type. Therefore, if Internet Explorer is configured to use an HTTP proxy, the sample will use the same proxy.Use the following to get Myfile.txt and dump it to the console by using an anonymous FTP connection: REFERENCESFor additional information, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
195650
(http://support.microsoft.com/kb/195650/EN-US/
)
HOWTO: How to Handle Proxy Authorization with WinInet
166961
(http://support.microsoft.com/kb/166961/EN-US/
)
HOWTO: FTP with CERN-Based Proxy Using WinInet API
APPLIES TO
| Article Translations
|

Back to the top
