In this tutorial, you will learn how to use local storage and manage session in Blazor Application. #localstorage #blazor #blazorlocalstorage #blazorsession
You could clear it by using the below: HttpContext.Session.Clear() Or you can set timeout: services.AddSession(options => { options.IdleTimeout = TimeSpan.FromSeconds(10); }); if IdleTimeout expires, the session expires. If the cookie expires, the session is gone. If the cookie is deleted, the session is gone. Calling Session.Clear() removes the contents of the session, but keeps the session intact (session is not deleted) More: docs.microsoft.com/en-us/aspnet/core/fundamentals/app-state?highlight=session&view=aspnetcore-5.0
As far as the latest .NET versions are concerned, this "tutorial" is so painfully out of date, it is not even funny. Will not work now, guaranteed. Best to update it or take the video down...
Thank you for this!
great video thx a lot :P
Cool
it is working at localhost but after deploy the code into server and not working this variable is null.
How do you clear local session, code wise, when you end the debugger?
You could clear it by using the below:
HttpContext.Session.Clear()
Or you can set timeout:
services.AddSession(options => { options.IdleTimeout = TimeSpan.FromSeconds(10); });
if IdleTimeout expires, the session expires. If the cookie expires, the session is gone. If the cookie is deleted, the session is gone.
Calling Session.Clear() removes the contents of the session, but keeps the session intact (session is not deleted)
More: docs.microsoft.com/en-us/aspnet/core/fundamentals/app-state?highlight=session&view=aspnetcore-5.0
As far as the latest .NET versions are concerned, this "tutorial" is so painfully out of date, it is not even funny. Will not work now, guaranteed. Best to update it or take the video down...