Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the best way to force HTTP requests to HTTPS requests on IIS 6? For example, I have both a directory and a whole site that I need to force HTTPS on for two different servers. What is the best or preferred method of accomplishing this? This will need to redirect requests that come in on HTTP to HTTPS. I was thinking of something along the lines of mod_rewrite from the Linux world.

Note that I already have a certificate installed and working.

share|improve this question
up vote 2 down vote accepted

Sometimes I have a hard time deciphering exactly what's being asked, but I think this is what you're after:

Right click the web site in question in IIS Manager, click the Directory Security tab, click the Edit button under the Secure communications section, check (enable) the Require secure channel (SSL) check box.

share|improve this answer
Will that redirect people coming in from HTTP to HTTPS? – John Nov 10 '11 at 0:44
No, it's not a redirect, it's configuring the site so that only SSL connections will be accepted. I kind of thought I was misunderstanding what you were asking. – joeqwerty Nov 10 '11 at 0:46
That's okay, do you know how to force a redirect? – John Nov 10 '11 at 0:47
I don't, sorry. Someone else will chime in soon enough though. – joeqwerty Nov 10 '11 at 0:48
Here's a Google search returning several methods for achieving this:… – joeqwerty Nov 10 '11 at 0:50

One method is to include this in your global.asax.cs.

protected void Application_BeginRequest(object sender, EventArgs e)
    if (!Request.IsSecureConnection)
        Response.Redirect("https://" + Request.ServerVariables["HTTP_HOST"] + HttpContext.Current.Request.RawUrl);


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.