How to use HTTPS in an ASP.Net Application

  1. First get or create a certificate

  2. 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.

  3. Add secureWebPages tag to web.config

    <configuration>
        ...
        <secureWebPages enabled="true">
            ...
        </secureWebPages>
        ...
        <system.web>
            ...
        </system.web>
    </configuration>
    
  4. 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!

Leave a Comment