IIS7: HTTP->HTTPS Cleanly

前端 未结 6 1091
轮回少年
轮回少年 2020-12-04 06:32

Is there a clean way to redirect all attempts to going to an HTTP:// version of a site to its HTTPS:// equivalent?

6条回答
  •  时光取名叫无心
    2020-12-04 06:58

    I use classic asp (intranet) and on pages that requires login the logon include file does the redirect:

    if Request.ServerVariables("SERVER_PORT_SECURE") <> "1" or Request.ServerVariables("HTTPS") <> "on" then 
        Response.Redirect "https://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL")
    end if
    

    This of course does not include GET or POST data. So in effect it's a clean redirect to your secured page.

提交回复
热议问题