Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我最近对我的网站进行了安全审核,并被告知我需要将 'HttpOnly' 应用于我的 'auth' cookie。
我不知道如何在 web.config 文件中更改它。
该站点是 ASP.NET MVC。
如果有人能指出我正确的方向,我将不胜感激。
在 Web.config 中
<httpCookies httpOnlyCookies="true" …>
或通过 C# 代码
HttpCookie cookie = new HttpCookie("cookieName"); cookie.HttpOnly = true; Response.AppendCookie(cookie);