Source
Sub sslCheck()
Dim url,l
If Request.ServerVariables("HTTPS") <> "on" Then
url = "https://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL")
If Request.QueryString.Count > 0 Then url = url & "?" & Request.ServerVariables("QUERY_STRING")
Response.Redirect url
End If
End Sub