HttpContextServerVariableExtensions.GetServerVariable 方法

定義

取得目前要求之伺服器變數的值。

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ GetServerVariable(Microsoft::AspNetCore::Http::HttpContext ^ context, System::String ^ variableName);
public static string GetServerVariable (this Microsoft.AspNetCore.Http.HttpContext context, string variableName);
public static string? GetServerVariable (this Microsoft.AspNetCore.Http.HttpContext context, string variableName);
static member GetServerVariable : Microsoft.AspNetCore.Http.HttpContext * string -> string
<Extension()>
Public Function GetServerVariable (context As HttpContext, variableName As String) As String

參數

context
HttpContext

要求的 HTTP 內容。

variableName
String

變數的名稱。

傳回

null 如果伺服器不支援此功能,則為 IServerVariablesFeature 。 如果變數不存在或未設定,可能會傳回 Null 或空白。

適用於