HttpListenerRequest.IsAuthenticated 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 Boolean 值,指出傳送這個要求的用戶端是否已經過驗證。
public:
property bool IsAuthenticated { bool get(); };
public bool IsAuthenticated { get; }
member this.IsAuthenticated : bool
Public ReadOnly Property IsAuthenticated As Boolean
屬性值
如果用戶端已驗證,則為 true
,否則為 false
。
範例
下列程式代碼範例會顯示 屬性的值 IsAuthenticated 。
public static void ShowRequestProperties2 (HttpListenerRequest request)
{
Console.WriteLine("KeepAlive: {0}", request.KeepAlive);
Console.WriteLine("Local end point: {0}", request.LocalEndPoint.ToString());
Console.WriteLine("Remote end point: {0}", request.RemoteEndPoint.ToString());
Console.WriteLine("Is local? {0}", request.IsLocal);
Console.WriteLine("HTTP method: {0}", request.HttpMethod);
Console.WriteLine("Protocol version: {0}", request.ProtocolVersion);
Console.WriteLine("Is authenticated: {0}", request.IsAuthenticated);
Console.WriteLine("Is secure: {0}", request.IsSecureConnection);
}
Public Shared Sub ShowRequestProperties2(ByVal request As HttpListenerRequest)
Console.WriteLine("KeepAlive: {0}", request.KeepAlive)
Console.WriteLine("Local end point: {0}", request.LocalEndPoint.ToString())
Console.WriteLine("Remote end point: {0}", request.RemoteEndPoint.ToString())
Console.WriteLine("Is local? {0}", request.IsLocal)
Console.WriteLine("HTTP method: {0}", request.HttpMethod)
Console.WriteLine("Protocol version: {0}", request.ProtocolVersion)
Console.WriteLine("Is authenticated: {0}", request.IsAuthenticated)
Console.WriteLine("Is secure: {0}", request.IsSecureConnection)
End Sub
備註
您的應用程式會使用 AuthenticationSchemes 或 AuthenticationSchemeSelectorDelegate 屬性要求客戶端驗證。
您的應用程式不會收到 HttpListenerContext 未成功驗證之用戶端要求的 。