1.

Code to use http to https permanent in config file?

Answer»

Code to use HTTP to https permanent in CONFIG file?
Below is the code to use to TRANSFER permanent http to https:-



http to https

or we can write below code

protected void Application_BeginRequest(Object sender, EventArgs e)
{
if (HttpContext.Current.Request.IsSecureConnection.Equals(FALSE) && HttpContext.Current.Request.IsLocal.Equals(false))
{
Response.Redirect("https://" + Request.ServerVariables["HTTP_HOST"]
+ HttpContext.Current.Request.RawUrl);
}
}



Discussion

No Comment Found