Sunday, February 16, 2014

HOW TO: Use ASP to Force SSL for Specific Pages

Forcing ASP page to use https can be done in couple of ways, here I’m sharing how we can do this using code itself, rather than configuring IIS. Step 1: Create INC file with following code
if(Request.ServerVariables["SERVER_PORT"]== "80")
                string strSecureURL;
                strSecureURL = "https://";
                strSecureURL = strSecureURL + Request.ServerVariables["SERVER_NAME"];
                strSecureURL = strSecureURL + Request.ServerVariables["URL"];
Then save it as “” in web application root directory. Step 2: Add reference to INC file by adding below line:

Note: If you are using Master page, then you have to add this code inside

Step 3: Add https as new binding in IIS.

No comments:

Post a Comment

MS CRM 2011 KB Article customization Issue.

Recently I have encountered some issue while customizing Kb Article Entity. I was doing following configuration in Article form. 1. Add Ba...