HOW TO: Use ASP to Force SSL for Specific Pages

If you want to enforce security requiring the usage of SSL on some ASP pages you should modify the IIS configuration; if you've bought a Shared Hosting solution, you could not be allowed to change IIS configuration so I suggest the following workaround:

HOW TO: Use ASP to Force SSL for Specific Pages

Basically it use the following code:

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



Share on Google Plus

About Vittorio Pavesi

    Blogger Comment
    Facebook Comment

0 commenti: