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

iTextSharp: Generating a Basic PDF file (ASP.NET/C#)

Popup Window Countdown (JavaScript)