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

How to logout using link (HTTP GET) in Blazor and .NET 8?

$
0
0

In the previous version of Blazor I could use:

await SignOutManager.SetSignOutState();Navigation.NavigateTo($"authentication/logout");

Now, I have to use:

Navigation.NavigateToLogout("authentication/logout");

But the following code redirects me to Not found. Should I create a page "authentication/logout" or what?

@using Microsoft.AspNetCore.Components.WebAssembly.Authentication@inject NavigationManager Navigation<AuthorizeView><Authorized><button class="nav-link btn btn-link" @onclick="BeginLogOut">Log out</button></Authorized><NotAuthorized><a href="Account/Login">Log in</a></NotAuthorized></AuthorizeView>@code{    private void BeginLogOut()    {        Navigation.NavigateToLogout("authentication/logout");    }}

enter image description here

There is no single example anywhere :/


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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