HttpRequest.IsSecureConnection 屬性

定義

取得值,這個執會指示 HTTP 連接是否使用安全通訊 (也就是,HTTPS)。

public:
 property bool IsSecureConnection { bool get(); };
public bool IsSecureConnection { get; }
member this.IsSecureConnection : bool
Public ReadOnly Property IsSecureConnection As Boolean

屬性值

Boolean

如果連接為 SSL 連接,則為 true;否則為 false

範例

下列程式碼範例會判斷 屬性是否 IsSecureConnection 設定為 false。 如果是, SuppressContent 屬性會設定為 true,以停止傳送回應。

// Check whether the request is sent
// over HTTPS. If not, do not send 
// content to the client.    
if (!Request.IsSecureConnection)
{
    Response.SuppressContent = true;
}
' Check whether the request is sent
' over HTTPS. If not, do not return
' content to the client.
If (Request.IsSecureConnection = False) Then      
    Response.SuppressContent = True
End If

適用於