En ASP.NET, ajouter ces lignes dans le fichier web.config (dans la section <configuration>) :
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name= »Redirect all requests to https » stopProcessing= »true »>
<match url= »(.*) » />
<conditions logicalGrouping= »MatchAll »>
<add input= »{HTTPS} » pattern= »off » ignoreCase= »true » />
</conditions>
<action type= »Redirect » url= »https://{HTTP_HOST}{REQUEST_URI} » redirectType= »Permanent » appendQueryString= »false » />
</rule>
</rules>
</rewrite>
</system.webServer>