Redirect to secure site (ASP)

The following will redirect from http://www.domain.com/path/to/file.asp to https://www.domain.com/path/to/file.asp:

VBScript:
<%
If Request.ServerVariables("HTTPS") = "off" Then
    Response.Redirect("https://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL"))
End If
%>
JScript:
<%
if(Request.ServerVariables("HTTPS") == "off"){
    Response.Redirect("https://" + Request.ServerVariables("HTTP_HOST") + Request.ServerVariables("URL"))
}
%>

Comments

Popular posts from this blog

Select box manipulation with jQuery

Basic Excel Spreadsheet Generation (ASP/ASP.NET)

Link: HTML Agility Pack (.NET)