SameSite cookie updates in, or how the .Net Framework from December changed my cookie usage.

Published Feb 06 2020 09:45 AM 25.1K Views

The Internet is a constantly changing place, and the standards that govern it change as well. This week, on February 4th, one of those standards (actually a draft) will be replaced by a new draft (which is implemented by Chrome version 80) and other browsers that are soon to follow. This is the SameSite draft standard that has been around since 2016 and has gotten a major update last year. So why should you care and why are there updates from .Net Framework to change the way cookies are managed?

Third party cookies:


To answer these questions we must start at the beginning by making the difference between first and third party Http Cookies. Http Cookies are server headers comprised of a ‘Set Cookie’ header name and name value pairs in the body of the header that the Http server sends to the client along with responses to requests. The information is stored by the client (the browser) and is retransmitted to the server on each subsequent request. Here is what a session cookie from looks like when it is received from the server:

HTTP/1.1 200 OK
Cache-Control private
Content-Encoding    gzip
Content-Length      5536
Content-Type text/html; charset=utf-8
Date   Tue, 04 Feb 2020 16:36:28 GMT
Server Microsoft-IIS/10.0
Set-Cookie   ASP.NET_SessionId=2qvabe5nwvvunf1ihxp2gvwo; path=/; secure; HttpOnly; SameSite=Lax
Vary   Accept-Encoding

X-AspNet-Version    4.0.30319
X-Powered-By ASP.NET


A cookie can have many attributes to instruct the browser on how long it should be kept for, which parts of your website to send it back to, if to only send it back via a secure connection, etc. In the example above, the cookie is value for all paths inside my website (determined by the path=/ attribute), it should only be sent over Https connections (indicated by the ‘secure’) attribute, and so on.


Cookies are normally sent back by the browser to the website (and domain) that they were received from. If you have visited your browser will send cookies received from back to the servers hosting and will not send these cookies to other sites, such as, etc…. But what happens when you have a website that uses resources that are also coming from other sites? Suppose the following setup: my home page for my website ( uses a background image from In order to load the page, my browser will be making requests to both the server and the server as shown in the image below:




Assuming that I have also visited to check out their site, my browser will have cookies from both and . When I load my home page from, the browser will be sending the cookies from to the hosting webserver, but since the image of the background is located on it will also be sending the cookies from along with the request for the image.


In this example, the cookies sent with the green request (to are considered third party cookies, since they are not for the site that I have typed in the address bar of my web-browser.


SameSite specification.


In order to help manage when third party cookies should or should not be sent, depending on the situation, a new attribute was added to the Http Cookie specification. This attribute is the SameSite attribute and originally, it had two values: Lax and Strict.


Lax – meant that the cookie should be sent in some third-party scenarios (and I will come back to which in a minute)
Strict – meant that the cookie should only be sent back when it was not considered a third-party cookie.
Cookies with no attribute (missing the SameSite attribute all together) were treated as cookies that could be sent back by the browser in any scenario.


In the example above, if the request for had set a cookie with an attribute of SameSite=Strict, the browser should not have sent the cookie back when loading the page for, since here the cookie would have been considered a third party cookie.


At this point you may be wondering if all domains and host names inside domains are considered different? Are and two different sites or are they the same site? And the answer is that they are considered to be the same site. In general, all host names for a domain will be considered as being the SameSite, with some service exceptions. A good example is – when you create a blog on BlogSpot, you will receive a blog url that looks like This will be different from another BlogSpot url like Hence a login cookie from will not be sent to since they are not considered to be the same site.

The list of services that work this way are detailed here: - look for the declaration of services with the TLD (Top Level Domains)


When can a cookie marked as Lax be sent as a third-party cookie? The table below shows this:

Request type

Html sample code

Cookie Type allowed


<a href=””></a>

Lax, <None>


<link rel=”prerender” href=”” />

Lax, <None>

Form Get

<form method=”GET” action=”” >

Lax, <None>

Form Post

<form method=”POST” action=”” >



<iframe src=””></iframe>






<img src=””>



Also note that cookies with no SameSite attribute present (marked with <None> in the table) will be sent along with any of the requests above, even if these requests are made to third party sites, and hence the cookies are considered third party cookies.


New SameSite specification:


The issue with the old specification that came out in 2016 is that by default cookies do not have any SameSite attribute, and that these cookies are treated just like before the specification was published. This is not very good for cross site tracking and cross site requests in general. The new standard aims to change that by doing two things:


  1. It introduces a new value for the SameSite attribute: None.
  2. It changes the default norm: cookies with no SameSite attribute will now be considered to implicitly behave just like cookies with the SameSite attribute set to ‘Lax’.

Point number 2 in the above list is very important: this changes the way that cookies will be sent by the browser: before if the cookie did not have a SameSite attribute, it would be sent along with all requests, whereas now, it will abide by the same rules as the Lax attribute imposes (and that are listed in the table above).


This also creates a problem, since, although being inherently more secure, some older browses are not aware of the new value for the SameSite attribute – the value ‘None’. The version of the specification that was written in 2016 indicated that if the SameSite attribute had an unknown value, it should be considered the same as ‘Strict’ – which is the opposite of SameSite=None.


Some of the older browsers around on the web, notably Chrome versions 50 through 60, and Safari on IOS 12, will consider a cookie marked with SameSite=None to be SameSite=Strict and behave accordingly. This is why, some sites will have to alter their code and detect which browser we are dealing with and then emit the cookie with or without a SameSite=None attribute accordingly. Note that this is the only case where conditional rendering would have to be applied to transition from the old to the new specification.


.Net Framework roll-ups from November / December 2019


To anticipate the upcoming implementation of the SameSite specification, the .Net Framework team has released updates to the .Net Framework 4.7.2 and 4.8 that will mark all Session and Authentication cookies that do not have a SameSite attribute present as being SameSite=Lax. This helps do away with the implicit consideration of cookies with no SameSite attribute as being the same as cookies marked as SameSite=Lax. Note that all cookies that are generated by the application, and are not session related or Authentication related remain unchanged. We will review later how to change the behavior to have a SameSite attribute explicitly emitted for these cookies as well.


The roll-ups for the .Net Framework have come out at the end of November, and the start of December 2019 (depending on the operating system we are targeting). The chart below aims to show the release dates:




All roll-ups of the .Net Framework 4.7.2 and 4.8 after these dates will contain the cumulative updates included in the November / December 2019 timeframe. Therefore, a website that is running on an updated version of the .Net Framework will immediately start emitting cookies with the SameSite attribute set to ‘Lax’ whereas no SameSite attribute was present before.

!One more thing: updating to .Net Framework 4.8?

If you are upgrading your .Net Framework installation from 4.7.2 to 4.8 be very careful. The installer for .Net Framework 4.8 brings in the RTM version of the framework, which does not contain the new specification changes for the SameSite attribute. You will need to perform the updates for the .Net Framework to bring it up to at least the updates from December 2019 before this functionality will be present.

In the next installment, we take a look at what scenarios this change will impact sites and what you (as a website owner) can do to become compliant.

Written by: Paul Cociuba

Senior Member
Typo in your definition I think: Strict – meant that the cookie should only be sent back when it was considered a third-party cookie.

Hello MatthewSt: thanks for spotting that - fixed now.

Occasional Visitor

Thanks for this post. Another typo as well. Search for "rool-up".

Another little typo Http Cookie specufication

NOTE: IE11 on build 16299+ also support this feature if all updates are applied to the OS


@Pierre-Louis Coll : great to know that IE is also using this!

I have also fixed the typo ;)


@Scalpel78 : thanx, fixed as well.

Occasional Visitor

I have an web mvc application using .net framework 4.5.2 and have an issue with iframe and samesite cookies on chrome browsers v80.
Samesite cookies were set to none previously but have been set to lax which breaks our application.
I wanted to know is there a way around this? In other later versions of the .net framework you can override this setting in the web.config.
Can this be done for v4.5.2?

New Contributor

We have the same problem here as Mistryman12.


@mistryman12 and @Michael Kostuch  : Unfortunately not: the settings were introduced with the December 2019 patches for .Net Framwork 4.7.2 and 4.8 and are not backwards compatible. You will need to upgrade your Framework version.!%3C%2FP%3E%0A%3CP%3EI%20have%20also%20fixed%20the%20typo%20%3B)!One%20more%20thing%3A%20updating%20to%20.Net%20Framework%204.8%3F%3C%2FSTRONG%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23000000%22%3EIf%20you%20are%20upgrading%20your%20.Net%20Framework%20installation%20from%204.7.2%20to%204.8%20be%20very%20careful.%20The%20installer%20for%20.Net%20Framework%204.8%20brings%20in%20the%20RTM%20version%20of%20the%20framework%2C%20which%20does%20not%20contain%20the%20new%20specification%20changes%20for%20the%20SameSite%20attribute.%20You%20will%20need%20to%20perform%20the%20updates%20for%20the%2
Version history
Last update:
‎Sep 29 2020 07:09 AM
Updated by: