我们如何将会话从http页面转移到https页面。
由于
答案 0 :(得分:1)
试试这个
protected override void OnInit(EventArgs e)
{
if (!Request.IsSecureConnection)
{
Response.Redirect(Request.Url.AbsoluteUri.ToLower().Replace("http://", "https://"), true);
}
}
页面加载
bool test = Request.IsSecureConnection;
if (!test)
{
Uri strQueryString = HttpContext.Current.Request.Url;
UriBuilder builder = new UriBuilder(strQueryString);
builder.Scheme = Uri.UriSchemeHttps;
builder.Port = 443;
Server.Transfer(builder.Uri.ToString());
}
答案 1 :(得分:0)
执行此操作的一种方法:将识别cookie放在用户的PC上或识别地址中的字符串,关闭会话,重定向到https,从那里获取cookie或地址中的身份信息并打开新会话...
答案 2 :(得分:0)
将会话值作为HTTP GET或POST请求的一部分从HTTP URL发送到HTTPS URL。