9

I've created a brand new site from Visual Studio, and selected "Individual User Account" authentication. The page _LoginPartial.cshtml contains the following:

<ul class="nav navbar-nav navbar-right">
    <li><a asp-area="Identity" asp-page="/Account/Register">Register</a></li>
    <li><a asp-area="Identity" asp-page="/Account/Login">Login</a></li>
</ul>

The site works, and allows me to navigate to the Register and Account pages; however, I can't see those pages in my project. I don't have, for example, a /Account/Register.cshtml. My assumption is that the line at the top of _LoginPartial:

@using Microsoft.AspNetCore.Identity

Has something to do with this; but what?

Are these pages hosted remotely (F12 doesn't seem to be telling me I'm leaving the site), are they baked in but hidden in some way, have I just missed them (if so, sorry!)?

  • 1
    2.1 introduced the ability to embed views in external DLLs, I'm guessing the templates do this now. – DavidG Jun 26 '18 at 15:23
  • `ASP.NET Core 2.1 and later provides ASP.NET Core Identity as a Razor Class Library. ` https://learn.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-2.1&tabs=visual-studio – Nkosi Jun 26 '18 at 15:27
  • https://stackoverflow.com/questions/50802781/where-are-the-login-and-register-pages-in-an-aspnet-core-scafolded-app – Alexan Jun 26 '18 at 17:00
  • Possible duplicate of [Where is the identity view?](https://stackoverflow.com/questions/51016785/where-is-the-identity-view) – Kirk Larkin Jun 26 '18 at 18:29

1 Answers1

5

ASP.NET Core 2.1 introduced the ability to embed views in external class libraries, and the templates are using this feature. See here for more information on how this works specifically with ASP.NET Core Identity and how to override the embedded views.

DavidG
  • 113,891
  • 12
  • 217
  • 223
  • This might be the subject of a separate question, but how would you use DI with these libraries? –  Jun 26 '18 at 15:53