Home  »  Articles  »  ASP.Net  »

How to redirect to HTTPS forcefully for all request?

 Posted By : Manoranjan SahooPosted Date : 11/06/2017 06:33:24 PM Category : ASP.Net Points : 2

Once i have the situation to redirect all the request to my customer's site to HTTPS with out changing any code in the source file. So, i tried to find the best solution on web and found one solution which is very easy and only need to use the URL rewrite in web.config file. See below code :

                <clear />
                <rule name="Redirect to https" stopProcessing="true">
                    <match url=".*" />
                        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
                    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
Hope this will help you.
No responses found for this thread. Be the first to respond this thread.
Post Reply
Login to post Response.