Skip to content

Cookie example does not work for .Net 8 template because the state container does not instantiate in user scope #31899

Closed
@kaleidocore

Description

@kaleidocore

Description

This example does not seem to work with the .Net 8 Blazor template, i.e. when using the new type of server-interactive rendering.
The reason is that the root App component does not render in user-scope, but rather in some anonymous pre-render scope that you cannot disable. This causes the state container (TokenProvider service) to instantiate once for the App component while a different (user-scoped) instance is created for the consuming component.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/security/server/additional-scenarios?preserve-view=true&view=aspnetcore-8.0#pass-tokens-to-a-server-side-blazor-app

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/security/server/additional-scenarios.md

Document ID

c98be365-408d-7ee6-cb74-14c44d01b0b8

Article author

@guardrex

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions