ASP.NET site. Redirect the entire domain from http to https

As in the title. How to redirect the entire domain, for example: http://testdomain.com.au/ to https://testdomain.com.au/ Can I do this in the IIRF file? If so, what should it look like? How to link an IIRF file to a site?

+4
source share
1 answer

You can do this with the IIS Rewrite module :

http://www.iis.net/downloads/microsoft/url-rewrite

http://www.iis-aid.com/articles/how_to_guides/redirect_http_to_https_iis_7

 <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /> </rule> 

Or you can redirect the Global.asax file:

 protected void Application_BeginRequest(Object sender, EventArgs e) { if ( !Request.IsSecureConnection) { string path = string.Format("https{0}", Request.Url.AbsoluteUri.Substring(4)); Response.Redirect(path); } } 

http://forums.asp.net/t/1340392.aspx

+7
source

Source: https://habr.com/ru/post/1433993/


All Articles