SocketTools .NET Edition

HttpServer.GetVariable Method (Int32, String, String)

Return the value of a CGI environment variable for the specified client.

[Visual Basic]
Overloads Public Function GetVariable( _
   ByVal clientId As Integer, _
   ByVal variableName As String, _
   ByRef variableValue As String _
) As Boolean
[C#]
public bool GetVariable(
   int clientId,
   string variableName,
   ref string variableValue
);

Parameters

clientId
An integer that identifies the client session.
variableName
A string that specifies the name of the environment variable. Variable names are not case-sensitive and should not include the equal sign which acts as a delimiter that separates the variable name from its value.
variableValue
A string variable that is passed by reference which will contain the value of the environment variable when the method returns.

Return Value

A boolean value which specifies if the header value was copied to the string buffer. A return value of true specifies that the operation was successful. If an error occurs, the method returns false and the application should check the value of the LastError property to determine the cause of the failure.

Remarks

The GetVariable method will return the value of an environment variable that has been defined for the client. Each client session inherits a copy of the process environment block, which is then modified to define various environment variables that are used with CGI programs and scripts. The SetVariable method can be used to change existing environment variables or create new variables.

The standard CGI environment variables that are defined by the server are not created until the client request has been processed. This means that environment variables such as REMOTE_ADDR and SERVER_NAME will not be defined inside an OnConnect event handler.

See Also