Skip to content

Instantly share code, notes, and snippets.

@samirahmed
Created November 13, 2014 14:13
Show Gist options
  • Save samirahmed/e591c27418655d4dbf72 to your computer and use it in GitHub Desktop.
Save samirahmed/e591c27418655d4dbf72 to your computer and use it in GitHub Desktop.
https redirect
protected void Application_BeginRequest()
{
// Redirect to https always
if (!Context.Request.IsLocal && !Context.Request.IsSecureConnection)
Response.Redirect(Context.Request.Url.ToString().Replace("http:", "https:"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment