Command Method  
 

Send a custom command to the server.

Syntax

object.Command( Command, Resource, [Parameters], [Options] )

Parameters

Command
A string which specifies the command to send. There are a number of standard commands which may be used, and there are extended commands which depend on the type of server that the client is connected to. Consult the protocol standard and/or the technical reference documentation for the server to determine what commands may be issued by a client application. An example of some common HTTP commands are:
Command Description
GET Return the contents of the specified resource. This command is recognized by all servers.
HEAD Return only header information for the specified resource. This command is recognized by servers that support at least version 1.0 of the protocol.
POST Post data to the specified resource. This command is recognized by servers that support at least version 1.0 of the protocol.
PUT Create or replace the specified resource on the server. This command is recognized by servers that support at least version 1.0 of the protocol. Not all servers support this command.
DELETE Delete the specified resource from the server. This command is recognized by servers that support at least version 1.1 of the protocol. Not all servers support this command.
Resource
A string which specifies the resource that the command is to be performed upon. The resource may be a file, such as an HTML document or an image, or it may be a script used to process data submitted by the client. Note that this argument specifies the name of the resource only, not a complete URL.
Parameters
An optional string or byte array which specifies one or more parameters to be sent along with the command. The parameter data is encoded according to the encoding type specified by the Encoding property. If the resource does not require any parameters, this argument should be omitted. Note that it is possible to pass binary data by specifying an array of bytes rather than a string as the argument.
Options
A numeric value which specifies one or more options. Currently this argument is reserved and should either be omitted, or a value of zero should always be used.

Return Value

A value of zero is returned if the command was successful. Otherwise, a non-zero error code is returned which indicates the cause of the failure. To determine the result code returned by the server in response to the command, read the value of the ResultCode property.

Remarks

The Command method sends a command to the server and processes the result code sent back in response to that command. This method can be used to send custom commands to a server to take advantage of features or capabilities that may not be supported internally by the control.

Not all servers support all of the listed commands, and some commands may require specific changes to the server configuration. In particular, the PUT and DELETE commands typically require that configuration changes be made by the site administrator. All servers will support the use of the GET command, and all servers that support at least version 1.0 of the protocol will support the POST command.

The Parameters argument is used to pass additional information to the server when a resource is requested. This is most commonly used to provide information to scripts, similar to how arguments are used when executing a program from the command line. Unless the POST command is being executed, the data in the buffer will automatically be encoded using the current encoding mechanism specified for the client. By default, the data is URL encoded, which means that any spaces and non-printable characters are converted to printable characters before submitted to the server. The type of encoding that is performed can be changed by setting the Encoding property. Although the default encoding is appropriate for most applications, those that submit XML formatted data may need to change the encoding type.

Only one request may be in progress at one time for each client session. Use the CloseFile method to terminate the request after all of the data has been read from the server.

See Also

Encoding Property, ResultCode Property, ResultString Property, OnCommand Event