【发布时间】:2016-06-07 14:22:44
【问题描述】:
我有一个在 SSL 上运行的应用程序,我已经在我的 web.config 中的 System.Web 下添加了以下内容。
<httpCookies requireSSL="true" httpOnlyCookies="true" lockItem="true" />
但我仍然得到一个名为“cookieSesssion1”的不安全 cookie。它没有被标记为安全。
请告诉我我可以将其标记为安全。
编辑: 除了 Web.config 指令之外,我的 Global.asax 文件中还有以下代码。
protected void Application_EndRequest(object sender, EventArgs e)
{
if (Response.Cookies.Count > 0)
{
foreach (string s in Response.Cookies.AllKeys)
{
Response.Cookies[s].Secure = true;
}
}
}
我错过了什么,请帮忙
【问题讨论】:
-
也许this -
This setting is overridden by any other feature that exposes the requireSSL configuration (for example: the forms Element for authentication (ASP.NET Settings Schema)).? -
这个 cookiesession1 是否与某些 Secure Token Service cookie 有关?
-
不,我在应用程序中使用普通会话,我什至没有引用这个 cookie
标签: c# asp.net .net session-cookies