Friday, September 28, 2018

How to Redirect Whole Classic ASP site from http to https (Force SSL for Specific Pages)

You have to open .asp file which is included each and every page of whole website like header.asp, leftmenu.asp, bottom.asp.

Write given below code at the top of this .asp file.

<%
   If Request.ServerVariables("SERVER_PORT")=80 Then
      Dim strSecureURL
      strSecureURL = "https://"
      strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")
      strSecureURL = strSecureURL & Request.ServerVariables("URL")
      Response.Redirect strSecureURL
   End If
%>