ā Is anybody knows how to explain what exactly HttpContext is and its attributes?
In this code:
Especially here -> var id = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
What exactly is HttpContext? Is it detecting an existing cookie in my enviroment?
What User is?
Thanks š
4 Replies
HttpContext is kind of a grab bag of... stuff
The request, the response, cookies, headers
.User is the currently logged-in user's claims, that are stored in the cookies or in the JWT tokenThank you
ā¤ļø
in general, "context" means just that, "additional data/stuff related to the thing"
it's everything that the framework designers thought might be useful to make available to middlewares for processing HTTP requests and building HTTP responses
mainly, it consists of the HTTP Request, Response, and Session State
pretty much everything on there logically falls into one of those buckets