Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoginDisplay.razor Logout link doesn't work #1

Open
df171422 opened this issue Apr 23, 2023 · 0 comments
Open

LoginDisplay.razor Logout link doesn't work #1

df171422 opened this issue Apr 23, 2023 · 0 comments

Comments

@df171422
Copy link

df171422 commented Apr 23, 2023

This issue is probably more suited to an AspNet Blazor Identity scaffolding forum, but I thought I'd try posting it here first. The logout link in /Pages/Shared/_LoginPartial.cshtml link works - clicking on it calls and hits breakpoints in the /Areas/Identity/Pages/Account/Logout.cshtml.cs class and successfully logs out the user, but the same link in the /Shared/LoginDisplay.razor component doesn't work, doesn't hit any breakpoints in the /Areas/Identity/Pages/Account/Logout.cshtml.cs class, and goes immediately to a 400 error page:

image

After further research, I found a hidden input at runtime in _LoginPartial.cshtml:

<form id="logoutForm" class="form-inline" action="/Identity/Account/Logout" method="post">
            <button id="logout" type="submit" class="nav-link btn btn-link text-dark">Logout</button>
        <input name="__RequestVerificationToken" type="hidden" value="CfDJ8MYF7EMsIsdIhI2h4kArxNzE7Ta6m4X1NxL8hNYiv1BQJQMSC1QbpbpHljdLPeJ6IBNQ4w0_hGAnaBwD9LXLA6GLAhHCqwjtWQPfdfpuxS0vCzzMRCGLRgcVRxAD2k6XroRpkc9SpMiQVZ-xoDiq3YgxO11CotKIWLFjtPfusnIDSiBM6d2vqtLRHA5amzWdDQ"></form>

that isn't in LoginDisplay.razor at runtime:

<form action="/Identity/Account/Logout?returnUrl=%2F" method="post"><button class="nav-link btn btn-link" type="submit">Logout</button></form>

When I copy the hidden input and paste it into the form in LoginDisplay.razor, it works. I don't see the hidden input anywhere in the form in _LoginPartial.cshtml...how is it getting there / what is putting it there? Any idea what's going on here?

Thanks-
Brad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant