Dela via


HttpContextExtensions.GetIISServerVariable(HttpContext, String) Method

Definition

Caution

This is obsolete and will be removed in a future version. Use GetServerVariable instead.

Gets the value of a server variable for the current request.

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ GetIISServerVariable(Microsoft::AspNetCore::Http::HttpContext ^ context, System::String ^ variableName);
public static string GetIISServerVariable (this Microsoft.AspNetCore.Http.HttpContext context, string variableName);
[System.Obsolete("This is obsolete and will be removed in a future version. Use GetServerVariable instead.")]
public static string GetIISServerVariable (this Microsoft.AspNetCore.Http.HttpContext context, string variableName);
[System.Obsolete("This is obsolete and will be removed in a future version. Use GetServerVariable instead.")]
public static string? GetIISServerVariable (this Microsoft.AspNetCore.Http.HttpContext context, string variableName);
static member GetIISServerVariable : Microsoft.AspNetCore.Http.HttpContext * string -> string
[<System.Obsolete("This is obsolete and will be removed in a future version. Use GetServerVariable instead.")>]
static member GetIISServerVariable : Microsoft.AspNetCore.Http.HttpContext * string -> string
<Extension()>
Public Function GetIISServerVariable (context As HttpContext, variableName As String) As String

Parameters

context
HttpContext

The http context for the request.

variableName
String

The name of the variable.

Returns

null if the server does not support the IServerVariablesFeature feature. May return null or empty if the variable does not exist or is not set.

Attributes

Remarks

For a list of common server variables available in IIS, see http://go.microsoft.com/fwlink/?LinkId=52471.

Applies to