I am trying to use the HttpCookie.SameSite option as shown in the snippet below, however I receive the following build error despite visual studio recognising this option as valid. I can even show the definition of the property within System.Web, yet the compiler doesn't seem to recognise this.
My framework is set to 4.7.2
HttpCookie cookie = HttpContext.Current.Request.Cookies["MyCookie");
if (cookie != null) {
cookie.Values("MyValue") = "123";
cookie.SameSite = SameSiteMode.Strict;
HttpContext.Current.Response.SetCookie(cookie);
}
'SameSite' is not a member of 'System.Web.HttpCookie'
My Framework is set to 4.7.2, however reading the snippet of System.Web.HttpCookie, it implies the default setting is 'Lax' however it seems to be 'None', indicating that a different System.Web is being loaded by the compiler.
Summary: Gets or sets the value for the SameSite attribute of the cookie.
Returns: One of the enumeration values that represents the enforcement mode of the cookie. If the application targets the .NET Framework 4.7.2 or later versions, the default value is System.Web.SameSiteMode.Lax; otherwise, the default value is System.Web.SameSiteMode.None.
Even though the framework of the project was set to 4.7.2 within visual studio, the Web.Config referenced an older web.config version; So for building I guess the web.config takes priority, yet VS uses the framework stated within the project file for it's intellisense.