For my dashboard, I am utilizing the fantastic AdminLTE. However, I am facing a small styling issue with the logout functionality as it needs to be a form in ASP.NET Core MVC.
Does anyone have any suggestions on how to use a normal anchor tag instead of the button around it? I attempted using asp-controller, but it did not log me out properly; instead, it redirected me to my home page.
The desired setup should resemble the link without the button effect around it.
Here is the code I am currently using:
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
<div class="dropdown-divider"></div>
<a asp-action="Setup" asp-controller="Admin" asp-route-id="1" class="dropdown-item">
<i class="fas fa-user mr-2"></i> Setups</a>
<div class="dropdown-divider"></div>
@if (User.Identity.IsAuthenticated) {
<a href="#" class="dropdown-item">
<form asp-controller="Account" asp-action="Logout" method="post" id="logoutForm">
<i class="fas fa fa-sign-in-alt mr-2"></i>
<button type="submit" class="nav-link">Sign out</button>
</form>
</a>
} else {
<a asp-area="Identity" asp-page="/Account/Login" class="dropdown-item dropdown-footer fa fa-sign-in-alt">Login</a>
<a asp-area="Identity" asp-page="/Account/Register" class="dropdown-item dropdown-footer">Register</a>
}
</div>
Here is the current appearance: