Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Loginpartial sin cambiar
- @using Microsoft.AspNetCore.Identity
- //simplemente si os fijáis cambio ese dato
- @inject SignInManager<IdentityUser> SignInManager
- @inject UserManager<IdentityUser> UserManager
- @if (SignInManager.IsSignedIn(User))
- {
- <form asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })" method="post" id="logoutForm" class="navbar-right">
- <ul class="nav navbar-nav navbar-right">
- <li>
- <a asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
- </li>
- <li>
- <button type="submit" class="btn btn-link navbar-btn navbar-link">Logout</button>
- </li>
- </ul>
- </form>
- }
- else
- {
- <ul class="nav navbar-nav navbar-right">
- <li><a asp-area="Identity" asp-page="/Account/Register" class="nav-link">Register</a></li>
- <li><a asp-area="Identity" asp-page="/Account/Login" class="nav-link">Login</a></li>
- </ul>
- }
- //loginpartial cambiado este es el que funciona
- @using Microsoft.AspNetCore.Identity
- @using Domotica_mysql.Data.CustomIdentity
- @inject SignInManager<ApplicationUser> SignInManager
- @inject UserManager<ApplicationUser> UserManager
- @if (SignInManager.IsSignedIn(User))
- {
- <form asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })" method="post" id="logoutForm" class="navbar-right">
- <ul class="nav navbar-nav navbar-right">
- <li>
- <a asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
- </li>
- <li>
- <button type="submit" class="btn btn-link navbar-btn navbar-link">Logout</button>
- </li>
- </ul>
- </form>
- }
- else
- {
- <ul class="nav navbar-nav navbar-right">
- <li><a asp-area="Identity" asp-page="/Account/Register" class="nav-link">Register</a></li>
- <li><a asp-area="Identity" asp-page="/Account/Login" class="nav-link">Login</a></li>
- </ul>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement