Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 481
Hamza Khanzada Avatar asked Oct 19 '19 13:10

Hamza Khanzada


2 Answers

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";
like image 157
user7217806 Avatar answered Sep 30 '22 04:09

user7217806


After scaffolding all files:

  1. Set Layout = "/Views/Shared/_Layout.cshtml"; in the file \Areas\Identity\Pages\Account\Manage_Layout.cshtml. For Net core 3.0 it is a matter of changing the else block in the top.
  2. Set Layout = "/Areas/Identity/Pages/Account/Manage/_Layout.cshtml"; in every cshtml file that you want to display in the left hand pane of the Manage section; the "fixed" options there.
like image 32
netfed Avatar answered Sep 30 '22 03:09

netfed