I am using cookies in one of my ASP.NET Core MVC (.NET Framework) applications. I am trying to keep an object value while the client browser session is alive. I want to read, write and update that value.
I order to serialize and deserialize my object I use the JavascriptSerializer class from System.Web.Script.Serialization namespace and in order to handle the cookie I am using the HttpResponse and HttpRequest classes from the Microsoft.ASPNetCore.Http namespace.
I can read the cookie then deserialize it to my object or Serialize my object then write it to the cookie. But I cannot update the cookie because of the Response.Cookies object not allowing me to update an existing cookie. Then I deleted the cookie and append it to the Response.Cookies object, that worked but. Is there any other way of updating a cookie within an MVC6 application without having to deleted it?. That is not "cookie updating"!!