Export (0) Print
Expand All
Expand Minimize

IHttpContext::GetServerVariable Method

IIS 7.0

Retrieves a specific server variable.

virtual HRESULT GetServerVariable(
   PCSTR pszVariableName,
   PCWSTR * ppszValue,
   DWORD * pcchValueLength
) = 0;
virtual HRESULT GetServerVariable(
   PCSTR   pszVariableName,
   PCSTR * ppszValue,
   DWORD * pcchValueLength
) = 0;

pszVariableName

A pointer to a string that contains the name of the server variable to return.

ppszValue

The address of a pointer to a string buffer that receives a copy of the server variable.

pcchValueLengthr

A pointer to a DWORD buffer that receives the length of the ppszValue parameter.

An HRESULT. Possible values include, but are not limited to, those in the following table.

Value

Description

S_OK

Indicates that the operation was successful.

ERROR_INVALID_INDEX

Indicates that the parameter is not valid.

The GetServerVariable method retrieves a server variable specified by the pszVariableName parameter from the current HTTP context, and it returns the value in a buffer pointed to by the ppszValue parameter. The server variable specified by the pszVariableName parameter can be a custom variable or a variable defined in Requests for Comments (RFC) 3875, "The Common Gateway Interface (CGI) Version 1.1."

NoteNote:

The GetServerVariable method supports returning both ANSI and Unicode values through overloaded methods. The buffer pointed to by the ppszValue parameter can be either a PCWSTR or PCSTR buffer.

Type

Description

Client

  • IIS 7.0 on Windows Vista

  • IIS 7.5 on Windows 7

  • IIS Express 7.5 on Windows XP, Windows Vista, Windows 7

  • IIS 8.0 on Windows 8 Client

Server

  • IIS 7.0 on Windows Server 2008

  • IIS 7.5 on Windows Server 2008 R2

  • IIS Express 7.5 on Windows Server 2003, Windows Server 2008, Windows Server 2008 R2

  • IIS 8.0 on Windows Server 2012

Product

IIS 7.0, IIS 7.5, IIS Express 7.5, IIS 8.0

Header

Httpserv.h

Community Additions

ADD
Show:
© 2014 Microsoft