Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Redirect http to https in IIS - Part 102

Suggested Videos
Part 99 - Implementing Enable button to unlock user accounts
Part 100 - Secure Socket Layer in
Part 101 - Implementing SSL in web application

In this video we will discuss about redirecting users from HTTP to HTTPS. In the previous session, we discussed about implementing SSL in Please watch Part 101, before proceeding with this video.

To redirect users from HTTP to HTTPS automatically, there are several ways. In this video we will discuss about using "url rewrite" module. There are 3 simple steps

Step 1:
Please download and install "URL ReWrite" module from the following link.

Step 2:
Uncheck "Require SSL" option from "SSL Settings" for the web application in IIS.

Step 3:
Copy and paste the following in the root web.config file of your application.
    <httpRedirect enabled="false" destination="" httpResponseStatus="Found" />
            <rule name="HTTP to HTTPS Redirection" stopProcessing="true">
                <match url="(.*)" />
                    <add input="{HTTPS}" pattern="off" />
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />

Now try to navigate to the application using HTTP, you will automatically be redirected to HTTPS.

These rules can also be created in IIS directly using the "URL Rewrite" module

In the next video we will discuss about using "IIS Error Pages" to redirect users from HTTP to HTTPS automatically.

1 comment:

  1. What are the below attributes inside the Rewrite module meant for?
    stopProcessing & pattern.Please leave a reply.


It would be great if you can help share these free resources