our site address is like "http://members.XXX.XX", so I want to redirect to the "https://members.XXX.XX" no matter user type "members.XXX.XX" or "http://members.XXX.XX", here is my code, and i put it in the default.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (Request.IsSecureConnection == false)
{
Response.Redirect(Request.Url.ToString().Replace("http://", "https://"));
}
if (!Request.Url.ToString().StartsWith("http://") || !Request.Url.ToString().StartsWith("https://"))
Response.Redirect("https://" + Request.Url.ToString());
Response.Redirect("~/pages/login.aspx");
}
which doesn't work, anyone can help? many thanks
Edit: We didn't do that in IIS because we instored the ELMAH which is a error logging system. My coworker said if we did that the ELMAH wouldn't work