Below are a few different ways I'm trying to set cookies for a user. I don't understand why I'm getting an error on the HttpCookie. If someone knows what I'm doing wrong please let me know or if you need more details on my problem.
How to correctly set cookies (HttpCookie) for ASP.NET Core
Asked Answered
Download Package Microsoft.AspNetCore.Http using Nuget Package Manager, refer this package in your class by writing using Microsoft.AspNetCore.Http;
Instead of HTTPCookie class ,You need to use CookieOptions Class as follow
CookieOptions langCookie=new CookieOptions(); langCookie.Expires=DateTime.Now.AddYears(1);
© 2022 - 2024 — McMap. All rights reserved.
asp.net-mvc
orasp.net-core-mvc
? Both frameworks are different. – Drifter