| |
| INT GetClientVariable( |
| |
UINT nClientId, |
|
| |
LPCTSTR lpszName, |
|
| |
LPTSTR lpszValue, |
|
| |
INT nMaxLength, |
|
| ); |
| INT GetClientVariable( |
| |
UINT nClientId, |
|
| |
LPCTSTR lpszName, |
|
| |
CString& strValue |
|
| ); |
Return the value of a CGI environment variable for the specified
client.
Parameters
- nClientId
- An unsigned integer which uniquely identifies the client
session.
- lpszName
- A null-terminated 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. This parameter cannot be a NULL pointer or an empty string.
- lpszValue
- A buffer that will contain the value of the
environment variable, terminated with a null character. To determine
the length of the header value, this parameter can be NULL and the
nMaxLength parameter should be specified with a value of zero.
- nMaxLength
- An integer that specifies the maximum number of characters that
can be copied into the value buffer, including the terminating null
character. If the lpszValue parameter is NULL, this
value must be zero.
Return Value
If the method succeeds, the return value is the length of
the environment variable value, not including the terminating null
character. If the client ID does not specify a valid client session, or
there is no environment variable that matches the given name,
the method will return zero. If the lpszValue parameter
is not NULL and the buffer is not large enough to store the complete
header value, the method will return zero and the last error code
will be set to ST_ERROR_BUFFER_TOO_SMALL. If the method fails, the
GetLastError method will return more information about the
last error that has occurred.
Remarks
The GetClientVariable 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 SetClientVariable
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.
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtsv12.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
|
|