Saturday, May 26, 2018

c# - How to store session data in server-side blazor

In a server-side Blazor app I'd like to store some state that is retained between page navigation. How can I do it?



Regular ASP.NET Core session state does not seem to be available as most likely the following note in Session and app sate in ASP.NET Core applies:





Session isn't supported in SignalR
apps because a SignalR Hub may
execute independent of an HTTP context. For example, this can occur
when a long polling request is held open by a hub beyond the lifetime
of the request's HTTP context.




The GitHub issue Add support to SignalR for Session mentions that you can use Context.Items. But I have no idea how to use it, i.e. I don't know hot to access the HubConnectionContext instance.




What are my options for session state?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...