Accessing HttpContext.Items fails on WebKit browsers #17585
Labels
area-blazor
Includes: Blazor, Razor Components
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
question
We're developing a .NET Core 3.1 Blazor application.
In short, we use custom middleware to authenticate the User and store the
IdentityUser
object in theHttpContext.Items
collection to retrieve it later in a scoped service. This works fine for most scenarios. However, there seems to be a problem when using a WebKit device (Apple iPad). TheHttpContext.Items
is always null. It seems that the behavior is different than with other browsers.The following code is throwing:
public IntranetUser User => _httpContextAccessor.HttpContext?.Items["IntranetUser"] as IntranetUser;
StackTrace:
Describe the bug
Access to HttpContext.Items is impossible on Apple devices.
Further technical details
The text was updated successfully, but these errors were encountered: