HttpCookie Class
HttpCookie Class
Provides a type-safe way to create and manipulate individual HTTP cookies.
Remarks
The HttpCookie class gets and sets properties of individual cookies. The HttpCookieCollection class provides methods to store, retrieve, and manage multiple cookies.
ASP.NET includes two intrinsic本质的,固有的 cookie collections. The collection accessed through the Cookies collection of the HttpRequest object contains cookies transmitted传输 by the client to the server in the Cookie
header. The collection accessed through the Cookies collection of the HttpResponse object contains new cookies created on the server and transmitted to the client in the Set-Cookie
HTTP response header.
Properties
Domain |
Gets or sets the domain to associate the cookie with. |
Expires |
Gets or sets the expiration date and time for the cookie. |
HasKeys |
Gets a value indicating whether a cookie has subkeys. |
HttpOnly |
Gets or sets a value that specifies whether a cookie is accessible by client-side script. |
Item[String] |
Gets a shortcut to the Values property. This property is provided for compatibility with previous versions of Active Server Pages (ASP). |
Name |
Gets or sets the name of a cookie. |
Path |
Gets or sets the virtual path to transmit with the current cookie. |
SameSite |
Gets or sets the value for the SameSite attribute of the cookie. |
Secure |
Gets or sets a value indicating whether to transmit the cookie using Secure Sockets Layer (SSL)--that is, over HTTPS only. |
Shareable |
Determines whether the cookie is allowed to participate in output caching. |
Value |
Gets or sets an individual cookie value. |
Values |
Gets a collection of key/value pairs that are contained within a single cookie object. |
HttpCookie.SameSite Property
Gets or sets the value for the SameSite attribute of the cookie.
One of the enumeration values that represents the enforcement执行,实施;强制 mode of the cookie or (SameSiteMode)(-1)
(represented by the string Unspecified
in config files). The default value depends on updates. For more information on defaults and recent updates, see Remarks.
Remarks
The default value of this property was modifed by updates described in KB article 4531182 and KB article 4524421.
Without these updates, the default value is SameSiteMode.None, which does not emit发出,放射;发行;发表 the SameSite
cookie header. This conforms to https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1.
After these updates have been applied, the default value is (SameSiteMode)(-1)
, which corresponds to Unspecified
. This preserves the earlier behavior. Setting SameSiteMode.None
causes "SameSite=None" to be emitted. This new behavior conforms to https://tools.ietf.org/html/draft-west-cookie-incrementalism-00.
作者:Chuck Lu GitHub |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
2018-06-22 NaN in JavaScript
2017-06-22 Whats the difference between git reset --mixed, --soft, and --hard?
2017-06-22 Import .bak file to a database in SQL server
2017-06-22 Resize图片