HttpListenerRequest.IsLocal 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得 Boolean 值,指出要求是否從本機電腦送出。
public:
property bool IsLocal { bool get(); };
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public bool IsLocal { get; }
public bool IsLocal { get; }
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.IsLocal : bool
member this.IsLocal : bool
Public ReadOnly Property IsLocal As Boolean
屬性值
如果要求和提供此要求的 HttpListener 物件都來自相同的電腦,則為 true
,否則為 false
。
- 屬性
範例
下列程式代碼範例示範如何使用 IsLocal 屬性。
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
備註
當要求來自本機計算機時,應用程式可以使用這個屬性來執行特殊處理。