Search code examples
asp.net-coreasp.net-identitycode-generationscaffolding

Cannot find Identity's Layout.cshtml file even after scaffolding all identity pages


I am using Asp.net core and I have scaffolded all the identity pages, it created a folder in my root directory named areas > Identity > Pages, and I have all the razor pages here and some pages in accounts folder and some in manage folder as shown in attached photo.

enter image description here

Problem is I cannot find the layout page for my edit profile page which is present in

Areas > Identity > Pages > Account > Manage > Index.cshtml

enter image description here

I have a _Layout.cshtml file in the manage folder which is referencing a layout like

@{
Layout = "/Areas/Identity/Pages/_Layout.cshtml";
}

But I cannot find the file in my directory which is being referenced, I have the following files in my Pages directory

enter image description here.

I even tried to scaffold _layout.cshtml file again to see if I have not missed that using Add > New Scaffold Item > Identity and I cant even find it here too

enter image description here

The Issue is in my Views > Shared > _Layout.cshtml file I have added my project's logo and its working fine on home page

enter image description here

but when I go to my profile page I see only my Project's name on the header and I cannot change it to my logo

enter image description here

I want my project's logo in my profile page, the page which I cannot find in my solution. Any help will be greatly appreciated.


Solution

  • Ensure to specify your layout file when scaffolding Identity, as shown in Scaffold Identity in ASP.NET Core projects.

    You could also just adapt the Layout variable to your existing layout file, e.g. (for a default ASP.NET Core MVC project):

    Layout = "/Views/Shared/_Layout.cshtml";