Home > Software engineering >  Automatic Logout On Close Tab/Browser - Blazor Server Side
Automatic Logout On Close Tab/Browser - Blazor Server Side

Time:02-19

Im Working on a Blazor Server Side app with Identity, and i want to end session when user close Tab / Browser, i try using the following

services.AddSession(options =>
        {
            options.IdleTimeout = TimeSpan.FromSeconds(300);
            options.Cookie.IsEssential = true;
            options.Cookie.HttpOnly = true;
            options.Cookie.Expiration = DateTime.MaxValue;
        });

But it didn't work. I think It's probably a misunderstanding of concepts from my part, would appreciate any help! Or if they need more data to Provide, just tell me!

CodePudding user response:

If you inject js on your blazor component, it's pretty simple, here you have an example from other user

  • Related