I need to access HttpContext
in a page (.cshtml) and in particular a request and then a cookie. Despite available, HttpContextAccessor
always has
Please note that the documentation explicitly states that IHttpContextAccessor should not be used for Blazor apps: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-context?view=aspnetcore-3.1#blazor-and-shared-state
(This does not mean that in your particular case it will not work for a particular scenario. But as you are anyway only able to get the cookie from the first request - once SignalR takes over the are no cookies anymore - you should maybe get the value when _Host.cshtml is renderend, and pass it on as a string value to the Blazor components from there.)