We have 2 methods for this purpose:

1. You can add this line to your index.html/default.aspx web page

if (location.protocol !== "https:"){
location.replace(window.location.href.replace("http:","https:"));
}

 

2. If you are using higher version of IIS 6.1, just put this lines to web.config

<system.webServer>
<rewrite>
<rules>
<rule name="HTTPyi HTTPSye Yonlendirme" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>