【发布时间】:2013-03-20 05:02:26
【问题描述】:
每当使用 http 请求时,我想使用 https 重定向回页面。
我用过这段代码:
bool isSecure = false;
isSecure = Request.IsSecureConnection;
if(!isSecure)
{
string redirectUrl = Request.Url.ToString().Replace("http:", "https:");
Response.Redirect(redirectUrl);
}
页面示例如下
请求的页面:http://google.com/test.aspx?id=12233
重定向回:https://google.com/test.aspx?id=12233
目前它指向相同:http://google.com/test.aspx?id=12233 并显示错误:Internet Explorer 无法显示网页
我正在测试的网站目前没有经过 SSL 认证..但我的问题是..它不应该将页面重定向到 https,然后显示错误
【问题讨论】: