Redirect to SSL/HTTPS
I have a site where users must only be able to access the Login.aspx
page via SSL/HTTPS.
Currently I run something like the following in my Page_Load()
:
If Not (IsSSL) Then
Response.Redirect("https://" + thisDomainName + "/Login.aspx开发者_运维百科")
End If
Is there a better way of doing this?
I would say without using url re-writing rules or some other http module then no, this is the simplest way to get what you are after.
Seeing as it's only the one page, a more elaborate process would be overkill.
Using the various Request.URL... properties may be better than hard-coding however.
精彩评论