Customer Hub Language
 
Home Knowledge Base Programming Programmatically force a webpage to use SSL
Information
Article ID10
Created On5/8/2008
Modified8/7/2008
Share With Others
Programmatically force a webpage to use SSL

You can programmatically force your webpage to use SSL by using the following code in your page:

VB.NET

If (Request.ServerVariables("HTTPS") = "off") Then
 Response.Redirect("https://www.yourdomain.com/")
End If 


C#

if (Request.ServerVariables["HTTPS"] == "off")
{
 Response.Redirect("https://www.yourdomain.com/")
}