question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Review how identity scaffolder updates the layout to add the login partial

See original GitHub issue

Currently 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:closed
  • Created 5 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

8reactions
phantom2017-Novcommented, Aug 28, 2018

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) ?

1reaction
Rick-Andersoncommented, Nov 10, 2019

Close it. We get alot of traffic and comments on that topic. That page gets 18.5 PV/month.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found