0
两个部分的一个问题,在HTTP重定向到https赞成&重定向所有HTTP到HTTPS
的利弊我们刚刚实施了Azure的网站使用SSL。一些网页都从http到在Page_Load中HTTPS重定向,使用:
if (!Request.IsLocal && !Request.IsSecureConnection) {
string redirectUrl = Request.Url.ToString().Replace("http:", "https:");
Response.Redirect(redirectUrl, false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
第一部分 - 没有任何缺点重定向所有页面访问https?
第二部分 - 如果不是,则是上面的代码做到这一点的最好办法,还是应该使用URL重写这样的:
<rule name="Redirect to HTTPS">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="https://{SERVER_NAME}/{R:1}" redirectType="SeeOther" />
</rule>
所有的建议表示欢迎。
问候
投下的人可以让我知道为什么吗?我想提高我对SO的使用。 – OzDave