Name
IsSecureConnection
Synopsis
boolvar = Request.IsSecureConnection
Returns a Boolean indicating whether the current connection uses secure sockets (SSL) for communication.
Parameters
-
boolvar A Boolean variable to receive the SSL status of the current request.
Example
The example shows how you can take different actions depending on whether or not the current request was made via SSL:
Sub Page_Load( )
Dim boolvar As Boolean
boolvar = Request.IsSecureConnection
If boolvar = True Then
Message.Text = "Connection is HTTPS."
Else
Message.Text = "Connection is HTTP."
End If
End SubNotes
You would typically use this property to determine whether or not to fulfill a request that requires an SSL connection in order to encrypt sensitive data (such as credit card numbers) that might be submitted via the requested page. Additionally, you could use this property on a page that may or may not use SSL to determine how to render output to the page depending on the SSL status. Since encrypting and decrypting content for SSL communication exacts a performance penalty, reducing the number and/or size of graphics used on SSL-enabled pages is generally considered good practice. With this property, you could render more and/or higher-resolution graphics when SSL is not enabled for the request, and render fewer and/or lower-resolution graphics for SSL requests.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access