开发者

How we transfer session from http page to https page

How we transfer my session from http page to http开发者_如何转开发s page.

Thanks


Try this

protected override void OnInit(EventArgs e)
{
    if (!Request.IsSecureConnection)
    {
        Response.Redirect(Request.Url.AbsoluteUri.ToLower().Replace("http://", "https://"), true);
    }
}

On page load

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


One way to do this: Put identifying cookie on user's pc or identifying string in address, close session, redirect to https, from there get identity information from the cookie or the address and open a new session...


Send session values as part of an HTTP GET or POST request from the HTTP URL to the HTTPS URL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜