1

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!

Leandro Toloza
  • 1,655
  • 1
  • 6
  • 24
  • 1
    you should implement a CircuitHandler for this. https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.server.circuits.circuithandler?view=aspnetcore-3.1 – Asım Gündüz Feb 05 '22 at 21:51
  • 1
    here is a sample project: https://github.com/nagytam/BlazorCircuitHandler – Asım Gündüz Feb 05 '22 at 21:53

0 Answers0