How to Automatically Force a Site Visitor to Switch from HTTP to HTTPS

Here is a snippet of ASP code that will allow dynamic redirects from HTTP to HTTPS on your Alentus Hosted Webpage:
 
<%
Dim strQUERY_STRING
Dim strSecureURL
Dim strWork
 
' Get server variables
strQUERY_STRING = Request.ServerVariables("QUERY_STRING")
 
' Fix the query string:
strWork = Replace(strQUERY_STRING,"http","https")
strWork = Replace(strWork,"403;","")
strWork = Replace(strWork,":80","")
 
' Now, set the new, secure URL:
strSecureURL = strWork
 
Response.Redirect(strSecureURL)
%>
 
NOTE: make sure to set "require secure channel" ON under directory security for the website on IIS and set it OFF on the actual file that is running the code for the custom error redirect (eg. redirect.asp)

Add Feedback