If you are trying to add the built-in ASP.NET Core Identity Authentication scaffolding to an MVC application, you will notice that traversing between MVC controller actions and simple requests to Razor Pages doesn't work as transparently as you might expect.
To scaffold the Identity Razor Pages so that we can customize them, we first do the following:
An MVC logout link that you want to redirect to an overridden Identity auth Login Razor page might look like this in your _Layout view:
In order to reach the Login Razor page (when not being authenticated) you will need to add the [AllowAnonymous] attribute to the LoginModel class a la:
An that's it. You can customize all of the front-end and back-end code of the scaffolded Identity Razor pages. This is an example of customization that uses the extRS service to create SSRS user accounts when a user registers a new Identity account for the app:
I'm not sure why but much of this is not documented (and what is documented is not easily found).
Lastly, do keep in mind that in order to override certain items like "_LoginPartial", you need to rename to view, as was done with "_LoginPartial2.cshtml" in the extRS project, for example.
References:
https://github.com/sonrai-LLC/extRS/tree/main/ExtRS.Portal
No comments:
Post a Comment