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.

C#
public static string GetIISServerVariable (this Microsoft.AspNetCore.Http.HttpContext context, string variableName);
C#
[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);
C#
[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);

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

Product Versions (Obsolete)
ASP.NET Core 2.2 (3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0)