Review how identity scaffolder updates the layout to add the login partial
See original GitHub issueCurrently the identity scaffolder updates the app layout with the following code to add the login partial:
<div class="navbar-collapse collapse">
@{
var result = Engine.FindView(ViewContext, "_LoginPartial", isMainPage: false);
}
@if (result.Success)
{
await Html.RenderPartialAsync("_LoginPartial");
}
else
{
throw new InvalidOperationException("The default Identity UI layout requires a partial view '_LoginPartial' " +
"usually located at '/Pages/_LoginPartial' or at '/Views/Shared/_LoginPartial' to work. Based on your configuration " +
$"we have looked at it in the following locations: {System.Environment.NewLine}{string.Join(System.Environment.NewLine, result.SearchedLocations)}.");
}
</div>
We should review this code and make share it is appropriate for all layouts.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (10 by maintainers)
Top Results From Across the Web
Review how identity scaffolder updates the layout to add ...
Currently the identity scaffolder updates the app layout with the following code to add the login partial: @{ var result = Engine.
Read more >Scaffold Identity in ASP.NET Core projects
Learn how to scaffold Identity in an ASP.NET Core project. ... Optional: Add the login partial ( _LoginPartial ) to the layout file:....
Read more >The default Identity UI layout requires a partial view ' ...
When I access my app, all seems fine. It's just as I click on Fetch Data, the guarded part of the app, that...
Read more >MVC Login and Registration with Identity - .NET Core 6 - Part 1
Learn to add Identity to .NET Core 6 MVC Application We will customize the DbContext, the Identity User and Setup the corresponding login...
Read more >ASP.NET Core 2.2 - Scaffold Identity UI
Right click the project name > Add > New Scaffolded Item. · Select Identity in the left menu. · Check Override all files...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It is 2018, and you decided to hard code a reference to a “_LoginPartial” in your code ! Wow! Why do you keep changing things that are working, especially if you can’t give a seamless upgrade … This is wasting time to figure out where the reference to this file is & how to get rid of it - if at all possible. Further, it seems to generate its own templated page … who asked for all of this brilliancy from your side ? (The assumption seems to be that there is always a “Layout” page – why has this assumption been made (regardless of “best” practices) ?
Close it. We get alot of traffic and comments on that topic. That page gets 18.5 PV/month.