.net 5, _StatusMessage.cshtml implementation detail in @page

Alfonso 141 Reputation points
2022-01-11T01:20:20.207+00:00

Hi,

I am using AspNetCore.Identity to create a web app.
Using scaffold-identity added a bunch of Razor pages automatically and I like how the temp message is setup with partial in those files.
An example below.

   @page  
   @model ChangePasswordModel  
   @{  
       ViewData["Title"] = "My Password";  
       ViewData["ActivePage"] = ManageNavPages.ChangePassword;  
   }  
     
   <h4>@ViewData["Title"]</h4>  
   <partial name="_StatusMessage" for="StatusMessage" />  

According to partial-tag-helper, partial name="_StatusMessage"... means using _StatusMessage.cshtml, however, using scaffold-identity did not actually add the file to my project. My assumption is that the access is hidden and gained through @page.

I want to look into how _StatusMessage.cshtml is written so I can use the same style on other pages that I created on my own.
Please let me know if anyone knows how to get to the detail of _StatusMessage.cshtml.

I am using .net 5 and Microsoft.VisualStudio.Web.CodeGeneration.Design package version is 5.0.2

Thank you.

Developer technologies | ASP.NET | ASP.NET Core
Microsoft Security | Microsoft Identity Manager
Developer technologies | C#
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2022-01-12T06:00:31.887+00:00

    Hi @Alfonso ,

    As far as I know, the visual studio provide the scaffold method which could generate the identity page which you want to modified. More details about how to use it, I suggest you could refer to below steps:

    1.Right click the project and select add , choose scaffold item

    164069-image.png

    2.Select Identity.

    164177-image.png

    3.Select StatusMessage

    164110-image.png

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,926 Reputation points Volunteer Moderator
    2022-01-11T16:03:44.237+00:00

    Razor pages, unlike razor views support being compiled into a dll. The identity dll contains the razor pages as compiled code.

    You can override the pages. See the docs.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.