开发者

Redirect to SSL/HTTPS

开发者 https://www.devze.com 2023-02-13 08:43 出处:网络
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():

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消