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

适用于