【发布时间】:2015-06-14 13:23:21
【问题描述】:
我需要为我网站的所有 cookie 设置 httponly 和 secure 标志,以通过客户的安全扫描。
我认为 web.config 配置正确
<system.web>
<httpCookies httpOnlyCookies="true" requireSSL="true" lockItem="true" />
它适用于我在应用程序中创建的所有 cookie,但不适用于 google analitycs 的(我知道我对此无能为力)以及我认为 asp.net 的会话 cookie(ai_user和ai_session)。
搜索这两个 cookie 一无所获。
如何强制使用 httponly 和 secure 标志?
不知道有没有关系,不过我也有这个重写规则
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
我尝试禁用它,但没有任何改变
【问题讨论】:
-
看看this的文章希望它能给你一些想法
-
我试了代码,但是两个cookie没有出现在列表中。
标签: asp.net asp.net-mvc security cookies asp.net-mvc-5