HttpRequest.IsSecureConnection HttpRequest.IsSecureConnection HttpRequest.IsSecureConnection HttpRequest.IsSecureConnection Property

定義

取得值,這個執會指示 HTTP 連接是否使用安全通訊 (也就是,HTTPS)。Gets a value indicating whether the HTTP connection uses secure sockets (that is, HTTPS).

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

屬性值

如果連線為 SSL 連線,則為 true,否則為 falsetrue if the connection is an SSL connection; otherwise, false.

範例

下列程式碼範例會判斷是否IsSecureConnection屬性設定為 false。The following code example determines whether the IsSecureConnection property is set to false. 如果是,SuppressContent屬性設定為 true,以停止傳送回應。If it is, the SuppressContent property is set to true to stop the response from being sent.

// 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

適用於