Share via

HttpCookie.SameSite Property


Gets or sets the value for the SameSite attribute of the cookie.

 property System::Web::SameSiteMode SameSite { System::Web::SameSiteMode get(); void set(System::Web::SameSiteMode value); };
public System.Web.SameSiteMode SameSite { get; set; }
member this.SameSite : System.Web.SameSiteMode with get, set
Public Property SameSite As SameSiteMode

Property Value

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.


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.

Applies to