2010-09-16 54 views

回答

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

一種方法:將用戶的PC或識別地址,關閉會話字符串,標識的cookie,重定向到https,從那裏得到從cookie或地址的身份信息,並打開一個新的會話...

0

將會話值作爲HTTP GET或POST請求的一部分從HTTP URL發送到HTTPS URL。

相關問題