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

How can I use `` as a POST `` with an `` in Blazor?

$
0
0

How can I use <MudNavLink> as a POST <form> with an <AntiforgeryToken> in Blazor?

I have a <MudNavMenu> with several <MudNavLink>s. I want to create a logout button in the navigation menu, like the following form with an AntiforgeryToken:

<form>:

<Authorized><form action="authentication/logout" method="post"><AntiforgeryToken /><input type="hidden" name="ReturnUrl" value="@currentUrl" /><button type="submit" class="nav-link"><span class="bi bi-arrow-bar-left-nav-menu" aria-hidden="true"></span> Logout @context.User.Identity?.Name</button></form></Authorized>

How can I achieve the above using a <MudNavLink>? I have tried to embed it in a <MudButton> of submit type, but that looks bad.

<MudNavLink>:

<Authorized><MudNavLink Href="authentication/logout" Match="NavLinkMatch.Prefix" Icon="@Icons.Material.Filled.Logout">Logout</MudNavLink></Authorized>

Viewing all articles
Browse latest Browse all 4839

Trending Articles



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