How to use HTTPS in an ASP.Net Application

asp.net, https

Solution

First get or create a certificate

Get the SecureWebPageModule module from http://www.codeproject.com/Articles/7206/Switching-Between-HTTP-and-HTTPS-Automatically-Ver. Instructions for setup can be found in the article.

Add secureWebPages tag to web.config

<configuration>
    ...
    <secureWebPages enabled="true">
        ...
    </secureWebPages>
    ...
    <system.web>
        ...
    </system.web>
</configuration>

Add files and directories to be use for https protocol:

<secureWebPages enabled="true">
    <file path="Login.aspx" />
    <file path="Admin/Calendar.aspx" ignore="True" />
    <file path="Members/Users.aspx" />
    <directory path="Admin" />
    <directory path="Members/Secure" />
</secureWebPages> 

Hope this helps!

Problem

I want to use HTTPS in my ASP.NET web application, but only for the Login.aspx page. How can this be accomplished?

Original source