Advertisement
onzulin

Untitled

May 4th, 2019
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. //Loginpartial sin cambiar
  2. @using Microsoft.AspNetCore.Identity
  3. //simplemente si os fijáis cambio ese dato
  4. @inject SignInManager<IdentityUser> SignInManager
  5. @inject UserManager<IdentityUser> UserManager
  6.  
  7. @if (SignInManager.IsSignedIn(User))
  8. {
  9. <form asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })" method="post" id="logoutForm" class="navbar-right">
  10. <ul class="nav navbar-nav navbar-right">
  11. <li>
  12. <a asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
  13. </li>
  14. <li>
  15. <button type="submit" class="btn btn-link navbar-btn navbar-link">Logout</button>
  16. </li>
  17. </ul>
  18. </form>
  19. }
  20. else
  21. {
  22. <ul class="nav navbar-nav navbar-right">
  23. <li><a asp-area="Identity" asp-page="/Account/Register" class="nav-link">Register</a></li>
  24. <li><a asp-area="Identity" asp-page="/Account/Login" class="nav-link">Login</a></li>
  25. </ul>
  26. }
  27. //loginpartial cambiado este es el que funciona
  28. @using Microsoft.AspNetCore.Identity
  29. @using Domotica_mysql.Data.CustomIdentity
  30.  
  31. @inject SignInManager<ApplicationUser> SignInManager
  32. @inject UserManager<ApplicationUser> UserManager
  33.  
  34. @if (SignInManager.IsSignedIn(User))
  35. {
  36. <form asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })" method="post" id="logoutForm" class="navbar-right">
  37. <ul class="nav navbar-nav navbar-right">
  38. <li>
  39. <a asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @UserManager.GetUserName(User)!</a>
  40. </li>
  41. <li>
  42. <button type="submit" class="btn btn-link navbar-btn navbar-link">Logout</button>
  43. </li>
  44. </ul>
  45. </form>
  46. }
  47. else
  48. {
  49. <ul class="nav navbar-nav navbar-right">
  50. <li><a asp-area="Identity" asp-page="/Account/Register" class="nav-link">Register</a></li>
  51. <li><a asp-area="Identity" asp-page="/Account/Login" class="nav-link">Login</a></li>
  52. </ul>
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement