Microsoft Internet Transfer Control

The Internet Transfer control provides implementation of two of the most widely used protocols on the Internet, HyperText Transfer Protocol (HTTP) and File Transfer Protocol (FTP).

Using the HTTP protocol, you can connect to World Wide Web servers to retrieve HTML documents. With the FTP protocol, you can log on to FTP servers to download and upload files. The UserName and Password properties allow you to log on to private servers that require authentication. Otherwise, you can connect to public FTP servers and download files. Common FTP commands, such as CD and GET, are supported through the Execute method.


Topic Not Found

No matching topic was found. Some possible reasons and remedies are as follows:

  • The file (.chm) that contains the destination topic is not in the expected location.

    Remedy: Rerun the MSDN Library Setup.

  • The file (.chm) that contains the current topic or destination topic is out-of-date and the link is no longer valid.

    Remedy: Install the latest version of the MSDN Library.

  • The MSDN Library CD is not in the CD-ROM drive.

    Remedy: Insert the MSDN Library CD into the CD-ROM drive.


StateChanged Event

Occurs whenever there is a state change in the connection.

Syntax

object_StateChanged(ByVal State As Integer)

The StateChanged event syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
State | Integer. Specifies the state, as shown in Settings below.

Settings

The settings for State are:

Constant | Value | Description
icNone | 0 | No state to report.
icHostResolvingHost | 1 | The control is looking up the IP address of the specified host computer.
icHostResolved | 2 | The control successfully found the IP address of the specified host computer.
icConnecting | 3 | The control is connecting to the host computer.
icConnected | 4 | The control successfully connected to the host computer.
icRequesting | 5 | The control is sending a request to the host computer.
icRequestSent | 6 | The control successfully sent the request.
icReceivingResponse | 7 | The control is receiving a response from the host computer.
icResponseReceived | 8 | The control successfully received a response from the host computer.
icDisconnecting | 9 | The control is disconnecting from the host computer.
icDisconnected | 10 | The control successfully disconnected from the host computer.
icError | 11 | An error occurred in communicating with the host computer.
icResponseCompleted | 12 | The request has completed and all data has been received.

Remarks

In general, you will use the StateChanged event to determine when to retrieve data using the GetChunk method. To do this, use a Select Case statement and test for icResponseReceived (8) or icResponseCompleted (12).

Note, however, that the icResponseReceived state may occur when the control has completed an operation that hasn't resulted in any data in the buffer. For example, when connecting to an FTP site, the control will perform a "handshake" with the site that doesn't result in any data transfer, yet the icResponseReceived state will occur.

On the other hand, the icResponseCompleted state occurs after an operation has completed in its entirety. For example, if you are using the Execute method with the GET operation to retrieve a file, the icResponseCompleted event will occur only once — after the file has been totally retrieved.

In practice, using the icResponseReceived state allows you to parse the data until you have retrieved only the information you need (for example, when retrieving an HTML file, retrieving only the headers). Once you have the information, you can cancel the retrieval. On the other hand, if you are intent on retrieving the whole file, the icResponseCompleted state will notify you that the transfer is completed, allowing you to proceed.


Trappable Errors for the Internet Transfer Control

The following tables list the trappable errors and constants for the Internet Transfer control.

Constant | Value | Description
icOutOfMemory | 7 | "Out of memory"
icDisconnected | 10 | The computer has been disconnected from the network.
icTypeMismatch | 13 | "Type mismatch"
icInvalidPropertyValue | 380 | Invalid property value
icInetOpenFailed | 35750 | Unable to open internet handle.
icOpenFailed | 35751 | "Unable to open URL"
icBadUrlL | 35752 | "URL is malformed"
icProtMismatch | 35753 | "Protocol not supported for this method"
icConnectFailed | 35754 | "Unable to connect to remote host"
icNoRemoteHost | 35755 | "No remote computer is specified"
icRequestFailed | 35756 | "Unable to complete request"
icNoExecute | 35757 | "You must execute an operation before retrieving data"
icBlewChunk | 35758 | "Unable to retrieve data"
icFtpCommandFailed | 35759 | "FTP command failed"
icUnsupportedType | 35760 | "Cannot coerce type"
icTimeOut | 35761 | "Request timed out"
icUnsupportedCommand | 35762 | "Not a valid or supported command"
icInvalidOperation | 35763 | "Invalid operation argument"
icExecuting | 35764 | "Still executing last request"
icInvalidForFtp | 35765 | "This call is not valid for an FTP connection"
icOutOfHandles | 35767 | "Out of handles"
icinetTimeout | 35768 | "Timeout"
icInetTimeout | 35768 | Timeout
icExtendedError | 35769 | Extended error.
icIntervalError | 35770 | Internal error.
icInvalidURL | 35771 | Invalid URL.
icUnrecognizedScheme | 35772 | Unrecognized scheme
icNameNotResolved | 35773 | Name not resolved.
icProtocolNotFound | 35774 | Protocol not found.
icInvalidOption | 35775 | Invalid option.
icBadOptionLength | 35776 | Bad option length.
icOptionNotSettable | 35777 | Option not settable
icShutDown | 35778 | Shutdown
icIncorrectUserName | 35779 | Incorrect User name.
icLoginFailure | 35781 | Login failure.
icInetIvalidOperation | 35782 | Invalid operation.
icOperationCancelled | 35783 | Operation cancelled.
icIncorrectHandleType | 35784 | incorrect handle type.
icIncorrectHandleState | 35785 | incorrect handle state.
icNotProxyRequest | 35786 | Not a proxy.
icRegistryValueNotFound | 35787 | Registry value not found.
icbadRegistryParameter | 35788 | bad registry parameter.
icNoDirectAccess | 35789 | No direct access.
icIncorrectPassword | 35780 | Incorrect password.
icNoContext | 35790 | No context.
icNoCallback | 35791 | No callback.
icRequestPending | 35792 | Request pending.
icIncorrectFormat | 35793 | Incorrect format.
icItemNotFound | 35794 | Item not found.
icCannotConnect | 35795 | Cannot connect.
icConnectionAborted | 35796 | Connection aborted.
icConnectionReset | 35797 | Connection reset.
icForceEntry | 35798 | Force entry.
icInvalidProxyRequest | 35799 | Invalid proxy request
icWouldBlock | 35800 | Would block.
icHandleExists | 35802 | Handle exists.
icSecCertDateInvalid | 35803 | Security certificate date invalid.
icSecCertCnInvalid | 35804 | Security certificate number invalid.
icHttpsToHttpOnRedir | 35806 | HTTPS to HTTP on redirect.
icMixedSecurity | 35807 | Mixed security
icChgPostIsNotSecure | 35808 | Change post is not secure
icHttpToHttpsOnRedir | 35808 | HTTPS to HTTP on redirect.
icPostIsNonSecure | 35809 | Post is non-secure.
icClientAuthCertNeeded | 35810 | Client authorization certificate needed.
icInvalidCa | 35811 | Invalid client authorization.
icClientAuthNotSetup | 35812 | Client Authorization not set up.
icAsyncThreadFailed | 35813 | Async thread failed.
icRedirectSchemeChange | 35814 | Redirect scheme change.
icDialogPending | 35815 | The operation is suspended until you dismiss an open dialog box.
icRetryDialog | 35816 | Attempt the operation again.
icHttpsHttpSubmitRedir | 35818 | You must reattempt the operation again because a security zone check failed.
icInsertCdrom | 35819 | The installable CD cache requires a CD-ROM to be present in the drive.
icFtpTransferInProgress | 35876 | FTP: transfer in progress.
icFtpDropped | 35877 | Connection dropped.
icFtpNoPassiveMode | 35878 | A PASSIVE mode connection was attempted (that is, the original connect request specified INTERNET_FLAG_PASSIVE), but the server does not allow that mode.
icGopherProtocolError | 35896 | Gopher: protocol error.
icGopherNotFile | 35897 | Gopher: not a file.
icGopherDataError | 35898 | Gopher: data error.
icGopherEndOfData | 35899 | Gopher: end of data.
icGopherInvalidLocator | 35900 | Gopher: invalid locator.
icGopherIncorrectLocatorType | 35901 | Gopher: incorrect locator type.
icGopherNotGopherPlus | 35902 | Gopher: not Gopher plus.
icGopherAttributeNotFound | 35903 | Gopher: attribute not found.
icGopherUnknownLocator | 35904 | Gopher: unknown locator.
icHeaderNotFound | 35916 | HTTP: header not found.
icHttpDownlevelServer | 35917 | HTTP: downlevel server.
icHttpInvalidServerResponse | 35918 | HTTP: invalid server response.
icHttpInvalidHeader | 35919 | HTTP: invalid header.
icHttpInvalidQueryRequest | 35920 | HTTP: invalid query request.
icHttpHeaderAlreadyExists | 35921 | HTTP: Header already exists.
icHttpRedirectFailed | 35922 | HTTP: redirect failed.
icSecurityChannelError | 35923 | Security channel error.
icUnableToCacheFile | 35924 | Unable to cache file.
icHttpCookieNeedsConfirmation | 35927 | You must confirm a server-supplied cookie before the download can proceed.
icHttpCookieDeclined | 35928 | A cookie supplied by the server was not accepted.
icServerUnreachable | 35930 | The requested server was unable to be connected to. This was determined by receipt of a WSAEHOSTUNREACH error from WinSock.
icProxyServerUnreachable | 35931 | The requested proxy server was unable to be reached.
icBadAutoProxyScript | 35932 | There is an error in the proxy auto-configuration script, so the script cannot be run.
icUnableToDownloadScript | 35933 | The required proxy auto-configuration file could not be retrieved.
icHttpRedirectNeedsConfirmation | 35934 | You must confirm a protocol-level redirection before the download can proceed.
icSecInvalidCert | 35935 | The certificate is invalid.
icSecCertRevoked | 35936 | The certificate has been revoked.
icFailedDueToSecurityCheck | 35937 | The operation you attempted failed because it could not pass the security check.


Cancel Method

Cancels the current request and closes any connections currently established.

Syntax

object.Cancel

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Return Value

None


Execute Method Example

The example shows a series of common FTP operations using the Execute method. The example assumes that three TextBox controls exist on the form. The first, txtURL contains the URL of the FTP server. The second, txtRemotePath, contains additional information needed by the particular command. The third, txtResponse, contains the response of the server.

Private Sub cmdChangeDirectory_Click()
   ' Change directory to txtRemotePath.
   Inet1.Execute txtURL.Text, "CD " & _
   txtRemotePath.Text
End Sub

Private Sub cmdDELETE_Click()
   ' Delete the directory in txtRemotePath.
   Inet1.Execute txtURL.Text, "DELETE " & _
   txtRemotePath.Text
End Sub

Private Sub cmdDIR_Click()
   Inet1.Execute txtURL.Text, "DIR FindThis.txt"
End Sub

Private Sub cmdGET_Click()
   Inet1.Execute txtURL.Text, _
   "GET GetThis.txt C:\MyDocuments\GotThis.txt"
End Sub

Private Sub cmdSEND_Click()
   Inet1.Execute txtURL.Text, _
   "SEND C:\MyDocuments\Send.txt SentDocs\Sent.txt"
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
   ' Retrieve server response using the GetChunk
   ' method when State = 12.

   Dim vtData As Variant ' Data variable.
   Select Case State
   ' ... Other cases not shown.
   Case icError ' 11
      ' In case of error, return ResponseCode and
      ' ResponseInfo.
      vtData = Inet1.ResponseCode & ":" & _
      Inet1.ResponseInfo
   Case icResponseCompleted ' 12
      Dim vtData As Variant
      Dim strData As String
      Dim bDone As Boolean: bDone = False

      ' Get first chunk.
      vtData = Inet1.GetChunk(1024, icString)
      DoEvents

      Do While Not bDone
         strData = strData & vtData
         ' Get next chunk.
         vtData = Inet1.GetChunk(1024, icString)
         DoEvents

         If Len(vtData) = 0 Then
            bDone = True
         End If
      Loop
      txtData.Text = strData
   End Select

End Sub


GetChunk Method (Internet Transfer Control)

Retrieves data from in the StateChanged event. Use this method after invoking the Execute method as a GET operation.

Syntax

object.GetChunk( size [,datatype] )

The Get property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
size | Required. A long numeric expression that determines the size of the chunk to be retrieved.
datatype | Optional. An integer that specifies the data type of the retrieved chunk, as shown in Settings below.

Settings

The settings for datatype are:

Constant | Value | Description
icString | 0 | Default. Retrieves data as string.
icByteArray | 1 | Retrieves data as a byte array.

Return Type

Variant

Remarks

Use the GetChunk method in the StateChanged event. When the State property is icResponseCompleted (12), then use the GetChunk method to retrieve the buffer's contents.


GetChunk Method, StateChanged Event Example

The example uses the GetChunk method in the StateChanged event to retrieve a chunk of data. The example uses a Select Case statement to determine what to do with every possible state. The example assumes a TextBox control named txtData exists on the form.

Private Sub Inet1_StateChanged(ByVal State As Integer)
   ' Retrieve server response using the GetChunk
   ' method when State = 12. This example assumes the
   ' data is text.

   Select Case State
   ' ... Other cases not shown.

   Case icResponseReceived ' 12
      Dim vtData As Variant ' Data variable.
      Dim strData As String: strData = ""
      Dim bDone As Boolean: bDone = False

      ' Get first chunk.
      vtData = Inet1.GetChunk(1024, icString)
      DoEvents
      Do While Not bDone
         strData = strData & vtData
         DoEvents
         ' Get next chunk.
         vtData = Inet1.GetChunk(1024, icString)
         If Len(vtData) = 0 Then
            bDone = True
         End If
      Loop

      txtData.Text = strData
   End Select

End Sub


GetHeader Method

The GetHeader method is used to retrieve header text from an HTTP file.

Syntax

object.GetHeader (hdrName)

The GetHeader method syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
hdrName | Optional. A string that specifies the header to be retrieved.

Return Type

String

Remarks

If no header is named, all of the headers will be returned.

The table below shows some of the typical headers available.

Header Description
Date
 Returns the time and date of the document's transmission. The format of the returned data is Wednesday, 27-April-96 19:34:15 GMT.
MIME-version
 Returns the MIME protocol version, which is currently 1.00.
Server
 Returns the name of the server.
Content-length
 Returns the length in bytes of the data.
Content-type
 Returns the MIME Content-type of the data.
Last-modified
 Returns the date and time of the document's last modification. The format of the returned data is Wednesday, 27-April-96 19:34:15 GMT.


Execute Method

Executes a request to a remote server. You can only send requests which are valid for the particular protocol.

Syntax

object.Execute url, operation, data, requestHeaders

The Execute property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
url | Optional. String that specifies the URL to which the control should connect. If no URL is specified here, the URL specified in the URL property will be used.
operation | Optional. String that specifies the type of operation to be executed. See Settings below for a list of supported operations.
data | Optional. String that specifies the data for operations (See Settings below.)
requestHeaders Optional. String that specifies additional headers to be sent from the remote server. The format for these is:
header name: header value vbCrLf

Settings

Note Valid settings for operation are determined by the protocol being used. The tables below are organized by protocol.

Supported HTTP commands

Valid settings for operation are:

Operation | Description
GET | Retrieve data from the URL specified in the URL property.
HEAD | Sends the Request headers.
POST | Posts data to the server. The data is located in the data argument. This is an alternate method to GET, for which additional instructions are specified in the data argument.
PUT | Put operation. The name of the page to be replaced is located in the data argument.

Supported FTP commands

Important The FTP protocol uses a single string that includes the operation name and any other parameters needed by the operation. In other words, the data and requestHeaders arguments are not used; all of the operations and their parameters are passed as a single string in the operation argument. Parameters are separated by a space. In the descriptions below, do not confuse the terms "file1" and "file2" with the data and requestHeaders arguments.

The syntax for FTP operations is:

operationName file1 file2.

For example, to get a file, the following code invokes the Execute method, which includes the operation name ("GET"), and the two file names required by the operation:

Inet1.Execute "FTP://ftp.microsoft.com", _
"GET Disclaimer.txt C:\Temp\Disclaimer.txt"

Note File names that include embedded spaces are not supported.

Valid FTP settings for operation are:

Operation | Description
CD file1 | Change Directory. Changes to the directory specified in file1.
CDUP | Change to parent directory. Equivalent to "CD.."
CLOSE | Closes the current FTP connection.
DELETE file1 | Deletes the file specified in file1.
DIR file1 | Directory. Searches the directory specified in file1. (Wildcards are permitted but the remote host dictates the syntax.) If no file1 is specified, a full directory of the current working directory is returned. Use the GetChunk method to return the directory data.
GET file1 file2 | Retrieves the remote file specified in file1, and creates a new local file specified in file2.
LS file1 | List. Searches the directory specified in file1. (Wildcards are permitted but the remote host dictates the syntax.) Use the GetChunk method to return the file directory data.
MKDIR file1 | Make Directory. Creates a directory as specified in file1. Success is dependent on user privileges on the remote host.
PUT file1 file2 | Copies a local file specified in file1 to the remote host specified in file2.
PWD | Print Working Directory. Returns the current directory name. Use the GetChunk method to return the data.
QUIT | Terminates the current user.
RECV file1 file2 | Retrieves the remote file specified in file1, and creates a new local file specified in file2. Equivalent to GET.
RENAME file1 file2 | Renames the remote file named in file1 to the new name specified in file2. Success is dependent on user privileges on the remote host.
RMDIR file1 | Remove Directory. Removes the remote directory specified in file1. Success is dependent on user privileges on the remote host.
SEND file1 file2 | Copies a local file, specified in file1, to the remote host, specified in file2. Equivalent to PUT.
SIZE file1 | Returns the size of the directory specified in file1.

Return Type

None

Remarks

Many commands listed above can be carried out only if the user has privileges on the host server. For example, anonymous FTP sites will not allow anyone to delete files or directories.


OpenURL Method

Opens and returns the document at the specified URL. The document is returned as a variant. When the method has completed, the URL properties (and portions of the URL such as the protocol) are updated to reflect the current URL.

Syntax

object.OpenUrl url [,datatype]

The OpenURL property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
url | Required. The URL of the document to be retrieved.
datatype | Optional. Integer that specifies the type of the data, as shown in Settings.

Settings

The settings for datatype are:

Constant | Value | Description
icString | 0 | Default. Retrieves data as string.
icByteArray | 1 | Retrieves data as a byte array.

Return Type

Variant

Remarks

The OpenURL method's return value depends on the target of the URL. For example, if the target URL is the directory of an FTP server, the directory will be returned. On the other hand, if the target is a file, the file will be retrieved.

The OpenURL method is equivalent to invoking the Execute method with a GET operation, followed by a GetChunk method invoked in the StateChanged event. The OpenURL method, however, results in a synchronous stream of data being returned from the site.

If you are retrieving a binary file, be sure to use a byte array as a temporary variable before writing it to disk, as shown below:

Dim b() As Byte
Dim strURL As String
' Set the strURL to a valid address.
strURL = "FTP://ftp.GreatSite.com/China.exe"
b() = Inet1.OpenURL(strURL, icByteArray)

Open "C:\Temp\China.exe" For Binary Access _
Write As #1
Put #1, , b()
Close #1

Note When using the OpenURL method, set the URL property before you set the Password and UserName properties. If you set the URL property last, the UserName and Password properties will be set to "".


OpenURL Method Example

The example uses the OpenURL method to retrieve the directory of an FTP server. To try the example, place an Internet Transfer control and a RichTextBox control on a form. Paste the code into the Declarations section. Press F5 to run the example, and double-click on the form.

Private Sub Form_DblClick()
   Inet1.AccessType = icUseDefault
   RichTextBox1.Text = Inet1.OpenURL _
   (InputBox("URL", , "ftp://ftp.microsoft.com"))
End Sub

This example presumes the data is a binary file. Using a byte array, the file is retrieved and written to the disk using the Open, Put, and Close statements. To try the example, place an Internet Transfer control on a form and paste the code into the Declarations section. Press F5 and double-click on the form.

Private Sub Form_DblClick()
   Inet1.AccessType = icUseDefault
   Dim b() As Byte
   Dim strURL As String

   ' Presuming this is still a valid URL.
   strURL = "ftp://ftp.microsoft.com/" & _
   "developr/drg/Win32/Autorun.zip"

   ' Retrieve the file as a byte array.
   b() = Inet1.OpenURL(strURL, icByteArray)

   Open "C:\Temp\Autorun.zip" For Binary Access _
   Write As #1
   Put #1, , b()
   Close #1
   MsgBox "Done"
End Sub


AccessType Property

Sets or returns a value that determines the type of access (through a proxy or directly) that the control will use to communicate with the Internet. This value can be changed while an asynchronous request is being processed, but will not take effect until the next connection is established.

Syntax

object.AccessType = type

The AccessType property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
type | Integer (enumerated). A numeric expression that determines the type of access used, as described in Settings.

Settings

Valid settings for type are:

Constant | Value | Description
icUseDefault | 0 | Default. Use Defaults. The control uses default settings found in the registry to access the Internet.
icDirect | 1 | Direct to Internet. The control has a direct connection to the Internet.
icNamedProxy | 2 | Named Proxy. Instructs the control to use the proxy server specified in the Proxy property.


hInternet Property

Returns the Internet handle from the underlying Wininet.dll API. This handle can then be used in direct calls into the API. This property is not used when accessing the control from Visual Basic.

Syntax

object.hInternet

The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Data Type

Long


Document Property

Returns or sets the file or document that will be used with the Execute method. If this property is not specified, the default document from the server will be returned; for write operations, an error occurs if no document is specified.

Syntax

object.Document = string

The Document property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
string | The name of the file or document to be used with the Execute method.


Password Property (Internet Transfer Control)

Returns or sets the password that will be sent with the request to log on to remote computers. If this property is left blank, the control will send a default password.

Syntax

object.Password = string

The Password property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
string | The password to be sent when logging on to a remote computer.

Remarks

The default password the control sends will depend on the exact scenario, as shown in the table below:

UserName Property | Password Property | UserName sent to FTP Server | Password sent to FTP server
Null or "" | Null or "" | "anonymous" | User's email name
Non-null string | Null or "" | UserName property | ""
Null | Non-null string | Error | Error
Non-null string | Non-null string | UserName property | Password property


URL Property

Returns or sets the URL that is used by the Execute or OpenURL methods.

Syntax

object.URL [= url]

The URL property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
url | String that specifies the URL to be used in the Execute method.

Data Type

String

Remarks

Invoking the OpenURL or Execute method changes the value of this property.

Changing this property will have no effect until the next OpenURL or Execute method is called.

The URL property must contain at least a protocol and remote host name.

The URL property can be either a directory or a file. For example, both of the URLs below are valid:

' Setting this URL will return only the file directory:
Inet1.URL = "HTTP://www.microsoft.com"
' However, this URL will return the text of the file:
Inet1.URL = "HTTP://www.microsoft.com/disclaimer.txt"


Protocol Property (Internet Transfer Control)

Returns or sets a value that specifies the protocol that will be used with the Execute method.

Syntax

object.Protocol = integer

The Protocol property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
integer | Integer. A numeric expression that determines the protocol used, as described in Settings.

Settings

Valid settings for Protocol are:

Constant | Value | Description
icUnknown | 0 | Unknown.
icDefault | 1 | Default protocol.
icFTP | 2 | FTP. File Transfer Protocol.
icReserved | 3 | Reserved for future use.
icHTTP | 4 | HTTP. HyperText Transfer Protocol.
icHTTPS | 5 | Secure HTTP.

Remarks

When this property is specified, the URL property is updated to show the new value. Also, if the protocol portion of the URL is updated, the Protocol property is updated to reflect the new value. The OpenURL and Execute methods may both modify the value of this property.

Changing the value of this property will have no effect until the next Execute or OpenURL method is called.


Proxy Property

Returns or sets the name of the proxy server used to communicate with the Internet. This property is only used when the AccessType property is set to icNamedProxy (3).

Syntax

object.Proxy = proxy

The Proxy property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
proxy | The name of the proxy server to be used.

Data Type

String

Remarks

Changing the value of this property will have no effect until the next Execute or OpenURL method is called.

You can set individual proxies for each protocol. For example, if your network has a proxy devoted to the ftp protocol named "CorpFTP" and it uses port 123, you can set it as:

Inet1.Proxy = "ftp=CorpFTP:123"

You can specify multiple gateways by separating each with a space. For example, if your HTTP proxy is named "CorpHTTP", and uses port 131, set both protocols this way:

Inet1.Proxy = "ftp=CorpFTP:123 HTTP=CorpHTTP:131"

If you do not specify which protocol you are trying to set, the same proxy will be used for all protocols. For example, the proxy named below will be used even the protocol is http:

Inet1.Proxy = "CorpFTP:123"


RequestTimeout Property

Returns or sets the length, in seconds, to wait before a time-out expires. If a request doesn't respond within the specified time, and if the request was made with the OpenURL method (synchronous), an error is generated; if the request was made with the Execute method, the StateChanged event will occur with an error code. Setting this property to 0 means infinity.

Syntax

object.RequestTimeout = time

The RequestTimeout property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
time | The length of time, in seconds, to wait before an error occurs.

Data Type

Long


ResponseCode Property

Returns the error code from the connection when the icError (11) state occurs in the StateChanged event. For a description of the error, check the ResponseInfo property.

Syntax

object.ResponseCode= code

The ResponseCode property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
code | The number returned by the remote server.

Data Type

Long

Remarks

Use the StateChanged event to receive notification of an error, as shown below:

Private Sub Inet1_StateChanged(ByVal State As Integer)
   Dim strMess As String ' Message variable.
   Select Case State
   ' ... Other cases not shown.
   Case icError  ' 11
      ' Get the Text of the error.
      strMess = "ErrorCode: " & Inet1.ResponseCode & _
      " : " & Inet1.ResponseInfo
   End Select

   Debug.Print strMess
End Sub


ResponseInfo Property

Returns the text of the last error that occurred. Check the ResponseCode property for the error code.

Syntax

object.ResponseInfo

The ResponseInfo property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
info | The response returned by the connection.

Return Type

String

Remarks

Use the StateChanged event to receive notification of an error, as shown below:

Private Sub Inet1_StateChanged(ByVal State As Integer)
   Dim strMess As String ' Message variable.
   Select Case State
   ' ... Other cases not shown.
   Case icError  ' 11
      ' Get the Text of the error.
      strMess = "ErrorCode: " & Inet1.ResponseCode & _
      " : " & Inet1.ResponseInfo
   End Select

   Debug.Print strMess
End Sub


StillExecuting Property

Returns a value that specifies if the Internet Transfer control is busy. The control will return True when it is engaged in an operation such as retrieving a file from the Internet. The control will not respond to other requests when it is busy.

Syntax

object.StillExecuting = boolean

The StillExecuting property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
boolean | A Boolean expression specifying whether the control is busy or not.

Data Type

Boolean

Settings

The settings for boolean are:

Constant | Value | Description
True | –1 | The control is busy.
False | 0 | The control is not busy.


UserName Property

Returns or sets the name that will be sent with requests to remote computers. If this property is left blank, the control will send "anonymous" as the user name when requests are made.

Syntax

object.UserName[= name]

The UserName property syntax has these parts:

Part | Description
object | An object expression that evaluates to an object in the Applies To list.
name | String that specifies the UserName to be used in the Execute method.

Data Type

String

Remarks

Invoking the OpenURL or Execute method changes the value of this property.

Changing this property will have no effect until the next OpenURL or Execute method is called.