Asp.net 如何将会话从http页面传输到https页面

Asp.net 如何将会话从http页面传输到https页面,asp.net,Asp.net,如何将我的会话从http页面传输到https页面 谢谢,一种方法是:将标识cookie放在用户pc上或地址中的标识字符串,关闭会话,重定向到https,从那里从cookie或地址中获取身份信息并打开新会话…一种方法是:将标识cookie放在用户pc上或地址中的标识字符串,关闭会话,重定向到https,从那里从cookie或地址获取身份信息并打开一个新会话…试试这个 protected override void OnInit(EventArgs e) { if (!Request.IsS

如何将我的会话从http页面传输到https页面


谢谢,一种方法是:将标识cookie放在用户pc上或地址中的标识字符串,关闭会话,重定向到https,从那里从cookie或地址中获取身份信息并打开新会话…

一种方法是:将标识cookie放在用户pc上或地址中的标识字符串,关闭会话,重定向到https,从那里从cookie或地址获取身份信息并打开一个新会话…

试试这个

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());
    }
试试这个

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());
    }

将会话值作为HTTP GET或POST请求的一部分从HTTP URL发送到HTTPS URL

将会话值作为HTTP GET或POST请求的一部分从HTTP URL发送到HTTPS URL