If you need to automatically redirect HTTP to HTTPS in IIS. You can use the help of the URL Rewriter plugin in IIS.
In your .Net web config file under the root folder of your site application. There is a section under system.webServer, you can pass the following rule code.
<system.webServer> <rewrite> <rules> <rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}{UNENCODED_URL}" appendQueryString="false" /> </rule> </rules> </rewrite> </system.webServer>