Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

No Logout page scaffolded with new .net 8 Blazor Web App authentication

$
0
0

With Visual Studio I have created a Blazor Web App .net 8. I used the wizard to generate the template with Authentication Type = Individual Account and render mode = Auto.
Everything is OK and authentication works OK with all the generated pages from the template (Login, register etc...) BUT there is NO LOGOUT razor page scafolded by the template.

Of course tried to scaffold it but it crashed. I tried a lot of thing to create it manually and asking chatgpt but with no success.

Is there someone who has a clue how to add a logout page with the new template of web App??

The closest I came ,gives Not found when I logout, or when executing the page below it does not clear my authentication and return to the home page still authenticated

@page "/Account/Logout"@using Microsoft.AspNetCore.Authentication@using Microsoft.AspNetCore.Identity@inject IHttpContextAccessor HttpContextAccessor@inject NavigationManager Navigation@code {    [CascadingParameter]    private HttpContext HttpContext { get; set; } = default!;    private readonly HttpClient _httpClient;    protected override async Task OnInitializedAsync()    {        //await HttpContextAccessor.HttpContext.SignOutAsync();        await HttpContext.SignOutAsync();        Navigation.NavigateTo("/", true);    }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>