user336245
user336245

Reputation:

Enforce HTTPS on a site folder

As the title suggests is there any easy way to enforce HTTPS for certain site folders.

I am hoping that there is a solution to this using web.config settings.

We are using IIS 6 and ASP.NET Webforms and .NET 4.0

Does any one have any ideas or could point me in the right direction?

Upvotes: 0

Views: 213

Answers (2)

Bassel Shawi
Bassel Shawi

Reputation: 614

<system.webServer>     
  <rewrite>         
    <rules>             
      <rule name="Redirect HTTP to HTTPS" stopProcessing="true">           
        <match url="/yourfolder/(.*)"/>                 
        <conditions>                     
          <add input="{HTTPS}" pattern="^OFF$"/>                 
        </conditions>                 
        <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther"/>             
      </rule>         
    </rules>     
  </rewrite> 
</system.webServer>

Upvotes: 1

Related Questions