Hi Radzen Team,
I'm experimenting with RadzenPanelMenuItem
the side menu for Login/Logout operations.
<RadzenPanelMenu>
...
<AuthorizeView>
<Authorized>
...
<RadzenPanelMenuItem Text="Logout" Icon="logout" Path="Account/Logout"></RadzenPanelMenuItem>
</Authorized>
<NotAuthorized>
...
<RadzenPanelMenuItem Text="Login" Icon="login" Path="Account/Login"></RadzenPanelMenuItem>
</NotAuthorized>
</AuthorizeView>
...
</RadzenPanelMenu>
For Login, I got the solution in another post, but this doesn't work for Logout because it's necessary to include an <AntiForgeryToken />
.
This means that I must use a RadzenTemplateForm
instead of a RadzenPanelMenuItem
.
<RadzenPanelMenu>
...
<AuthorizeView>
<Authorized>
...
<RadzenPanelMenuItem Text="Logout" Icon="logout" Path="Account/Logout"></RadzenPanelMenuItem>
</Authorized>
<NotAuthorized>
...
<RadzenTemplateForm Action="Account/Logout" Method="post" TItem="string" >
<ChildContent Context="AChildContext">
<RadzenFieldset>
<AntiforgeryToken />
<RadzenTextBox @bind-Value="@returnUrl" Name="returnUrl" hidden="true"/>
<RadzenButton ButtonType="ButtonType.Submit" Icon="logout" Text="Logout" Variant="Variant.Text"></RadzenButton>
</RadzenFieldset>
</ChildContent>
</RadzenTemplateForm>
</NotAuthorized>
</AuthorizeView>
...
</RadzenPanelMenu>
This is ok, but the resulting style for the Logout button is completely different than the nice RadzenPanelMenuItem
style.
So, now, my question: could it be possible to have a RadzenPanelMenuItem
that works with a Method="post"
and could include elements like <AntiForgeryToken />
and attributes like returnUrl
?
That could be really gooood! ()