I'm converting a .net 4.7 MVC project to .net core 2, attempting to preserve as much of the code, as is, as possible. This project has a BaseService
that builds an AuthCookie
that's consumed by a few other services throughout the application.
// Create
public HttpCookie AuthCookie { get; set; } = new HttpCookie(AuthUtils.CookieName);
// Consume
if (AuthCookie?.Value != null) { ... }
In .net 4.7, the HttpCookie
class is included in the System.Web
namespace, but doesn't seem to exist in .net core 2 in the same way. As in, a cookie is built and handled outside the context of a controller.
I've seen: Why I can't use HttpContext or HttpCookie? (Asp.Net Core 1.0)
That doesn't seem to address this question. Is the fundamental difference in authentication handling in .net core so big that this case can't be handled?