The cookie to add. Commonly used properties are listed below. For further information about available properties and methods, visit the System::Web::HttpCookie documentation.
The cookie's domain.
The cookie's expiration date and time (on the client).
Specifies whether or not the cookie is available client-side. See Mitigating Cross-site Scripting With HTTP-only Cookies (Microsoft) to learn more about using this property.
The cookie's name.
The value of the SameSite attribute for the cookie. Can be System::Web::SameSiteMode::Lax, System::Web::SameSiteMode::None, or System::Web::SameSiteMode::Strict.
If the SameSite value is not set, i.e. "Unset", the browser will decide how to handle the cookie. Most desktop browsers will treat the cookie as "Lax" while some browsers on mobile devices may treat the cookie as "None" without the SSL requirement.
Whether or not the cookie should be transmitted over a secure connection (HTTPS).
Adds a cookie to the response's cookie collection.
Context.Response.AppendCookie(Cookie) adds a cookie to the response's cookie collection. If a cookie with the same name already exists, it's replaced with the new cookie.
dim cookieName as c = "MyCookieName" dim newCookie as System::Web::HttpCookie = new System::Web::HttpCookie(cookieName) newCookie.HttpOnly = .t. newCookie.Value = "This is the cookie's value." Context.Response.AppendCookie(newCookie)
dim cookie as System::Web::HttpCookie = new System::Web::HttpCookie("MyCookie", "MyCookieValue") cookie.HttpOnly = .t. cookie.SameSite = System::Web::SameSiteMode::None Context.Response.AppendCookie(cookie)
You cannot directly delete a cookie on a user's computer. To remove a cookie, you must set the cookie's expiration date and time to a time in the past. The browser will then remove the cookie the next time a request is made and the cookie is inspected.
dim cookieName as c cookieName = "CustomCookie" if Context.Request.HasCookie(cookieName) then dim cookie as System::Web::HttpCookie = Context.Request.GetCookie(cookieName) cookie.HttpOnly = .t. cookie.Expires = ctodt("1/1/1970 12:00:00 00 am") Context.Response.AppendCookie(cookie) end if