- On Solution Explorer, you can see the Web.config file.
- Add the following code snippet to the Web.config file. Open the file to get it done. You just need to add a piece of code to your Web.config file.
<system.webServer>    
   <rewrite>    
      <rules>    
      <rule name="Force HTTPS" enabled="true">    
   <match url="(.*)" ignoreCase="false"/>    
   <conditions>    
      <add input="{HTTPS}" pattern="off"/>    
   </conditions>    
   <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent"/>    
      </rule>    
      </rules>    
   </rewrite>    
</system.webServer> - What we are doing is just rewriting - when somebody comes to http, redirect them to https.
0 Comments
Post a Comment