我想将页面重定向到 ASPX 文件的安全连接。
要求客户复制并粘贴如下所示的 URLfoo.com.au
到浏览器中。
我在下面有这段代码处理文件背后的代码,但我想知道它何时部署到生产环境中是否会更新 URL,www
因为https://www
提供给客户端的 URL 中没有www
?
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
if (!Request.IsLocal && !Request.IsSecureConnection)
{
string redirectUrl = Request.Url.ToString().Replace("http:", "https:");
Response.Redirect(redirectUrl);
}
}