閱讀949 返回首頁    go 阿裏雲 go 技術社區[雲棲]


IBM AppScan 安全掃描:加密會話(SSL)Cookie 中缺少 Secure 屬性 處理辦法

問題描述:


原因分析:
服務器開啟了Https時,cookie的Secure屬性應設為true;
 
解決辦法:
1.服務器配置Https SSL方式,參考:https://support.microsoft.com/kb/324069/zh-cn
2.修改web.config,添加: 
<system.web>
  <httpCookies httpOnlyCookies="true" requireSSL="true" />
<system.web> 
3.修改後台寫Cookies時的設置 cookie.Secure = true:
       HttpResponse response = HttpContext.Current.Response;
            var cookie = new HttpCookie(keyvalue);
            cookie.HttpOnly = true;
            cookie.Path = "/";
            cookie.Expires = DateTime.Now.AddHours(1);
            cookie.Secure = true
            response.AppendCookie(cookie);

參考網站:https://stackoverflow.com/questions/5978667/how-to-secure-the-asp-net-sessionid-cookie



最後更新:2017-04-03 06:03:10

  上一篇:go obj-c編程05:類的多態與id動態綁定
  下一篇:go 三層架構(二)——為什麼要用三層架構?