ASP.NET Core Identity UI is implemented as Razor Pages, not MVC controllers and views. If you want to use MVC to manage the Identity workflow, you will have to write your own controllers and views.
Microsoft are recommending that people move away from MVC for traditional server-side web apps these days. Razor Pages is the recommended framework.
Create a new project that targets ASP.NET Core 2.0 templates and use the Individual Account option. This will produces scaffolded Actions and Views. Form there you can upgrade to Core 2.2.
As mike said,the default UI of Identity is razor page.So you need to write your own controllers and views.
I suggest that you can go to the official ASP.NET Core Identity Github Repository (https://github.com/aspnet/Identity) and download
it. Open the solution and search for the IdentitySample.Mvc project. Copy the necessary files to your project.
Notes: Don't forget to change the namespace on the added files since they belong to a different project.
Best Regards,
Rena
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Microsoft are recommending that people move away from MVC for traditional server-side web apps these days. Razor Pages is the recommended framework.
Do you know why ?
I used to do classic asp, then asp.net and then moved to MVC a few years ago, seems we are going round and round in circles ???
Razor Pages is a simpler approach to developing applications that are chiefly concerned with server-side HTML generation. The MVC framework was introduced because enterprise devs had massive problems bending the Web Forms system to their will, which at that
time focused on taking a Test Driven Development approach to producing applications. Also, Web Forms was very difficult to adapt or customise. So they eschewed Microsoft technologies in favour of Ruby On Rails and other frameworks that promoted loose coupling
and extensibility. Most of these frameworks used the MVC pattern, being a well established presentational pattern. So MS introduced their own MVC-based framework to solve the problems.
MVC is fine, but there is nothing specific to MVC that makes it a better framework for loose coupling, extensibility etc. You can design an MVC-based framework with all the problems that Web Forms had, if you wanted. MS could just as easily have produced
a new page-focused framework, but MVC frameworks were popular at the time.
MVC has its problems too. It has a relatively high concept count. You need to understand how the various abstract parts of the pattern work together. Then you need to understand how URLs are matched to controller actions. You have folders all over the project
that have nothing to do with the structure of the application, and everything to do with the conventions of the framework. Controllers are increasingly responsible for processing requests on behalf of multiple views, in conflict with the Single Responsibility
principal.
Razor Pages offers a much simpler approach to app development, where a URL matches a file path of disk, and there is a one-to-one mapping between the controller (PageModel class) and the view (Razor Page). It is a pattern that is familiar to classic ASP,
PHP, Web Forms, JSP developers, and is more intuitive to newcomers to web development. and yet. Razor Pages provides just as much lose coupling and extensibility as MVC ever did.
sounds very disappointing to me, as its going round and round in circles.
I know 2 people who stayed with classic ASP to this day, and it seems MS keeps moving the goal post thereby increasing the learning curve. I wonder what next ?
see the create full identity ui source. you probably want the identity actions to return json rather than html and use JWT authentication. here is a simple example:
Member
265 Points
1172 Posts
How do you scaffold controllers for identity pages ?
Sep 04, 2019 06:33 AM|afrika|LINK
hi guys
based on this post which explains how to scaffold identity pages, how do you also scaffold controllers and the models (For the identity pages) ?
https://forums.asp.net/t/2157924.aspx?How+do+you+edit+customize+the+Microsoft+Identity+pages
many thanks
Ehi
All-Star
52101 Points
23237 Posts
Re: How do you scaffold controllers for identity pages ?
Sep 04, 2019 10:53 AM|mgebhard|LINK
Scaffolding Identity is covered in the standard docs.
https://docs.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-2.2&tabs=visual-studio
All-Star
194007 Points
28027 Posts
Moderator
Re: How do you scaffold controllers for identity pages ?
Sep 04, 2019 03:02 PM|Mikesdotnetting|LINK
ASP.NET Core Identity UI is implemented as Razor Pages, not MVC controllers and views. If you want to use MVC to manage the Identity workflow, you will have to write your own controllers and views.
Microsoft are recommending that people move away from MVC for traditional server-side web apps these days. Razor Pages is the recommended framework.
Member
265 Points
1172 Posts
Re: How do you scaffold controllers for identity pages ?
Sep 04, 2019 03:05 PM|afrika|LINK
Do you know why ?
I used to do classic asp, then asp.net and then moved to MVC a few years ago, seems we are going round and round in circles ???
All-Star
52101 Points
23237 Posts
Re: How do you scaffold controllers for identity pages ?
Sep 04, 2019 04:00 PM|mgebhard|LINK
Create a new project that targets ASP.NET Core 2.0 templates and use the Individual Account option. This will produces scaffolded Actions and Views. Form there you can upgrade to Core 2.2.
Contributor
2680 Points
874 Posts
Re: How do you scaffold controllers for identity pages ?
Sep 05, 2019 02:24 AM|Rena Ni|LINK
Hi afrika,
As mike said,the default UI of Identity is razor page.So you need to write your own controllers and views.
I suggest that you can go to the official ASP.NET Core Identity Github Repository (https://github.com/aspnet/Identity) and download it. Open the solution and search for the IdentitySample.Mvc project. Copy the necessary files to your project.
Notes: Don't forget to change the namespace on the added files since they belong to a different project.
Best Regards,
Rena
Member
132 Points
344 Posts
Re: How do you scaffold controllers for identity pages ?
Sep 05, 2019 03:53 AM|pantonis|LINK
Please mark this post as answer if it helped you solve your problem
All-Star
194007 Points
28027 Posts
Moderator
Re: How do you scaffold controllers for identity pages ?
Sep 05, 2019 09:15 AM|Mikesdotnetting|LINK
MVC is fine, but there is nothing specific to MVC that makes it a better framework for loose coupling, extensibility etc. You can design an MVC-based framework with all the problems that Web Forms had, if you wanted. MS could just as easily have produced a new page-focused framework, but MVC frameworks were popular at the time.
MVC has its problems too. It has a relatively high concept count. You need to understand how the various abstract parts of the pattern work together. Then you need to understand how URLs are matched to controller actions. You have folders all over the project that have nothing to do with the structure of the application, and everything to do with the conventions of the framework. Controllers are increasingly responsible for processing requests on behalf of multiple views, in conflict with the Single Responsibility principal.
Razor Pages offers a much simpler approach to app development, where a URL matches a file path of disk, and there is a one-to-one mapping between the controller (PageModel class) and the view (Razor Page). It is a pattern that is familiar to classic ASP, PHP, Web Forms, JSP developers, and is more intuitive to newcomers to web development. and yet. Razor Pages provides just as much lose coupling and extensibility as MVC ever did.
Basically, it's Web Forms done properly.
Member
265 Points
1172 Posts
Re: How do you scaffold controllers for identity pages ?
Sep 05, 2019 05:22 PM|afrika|LINK
sounds very disappointing to me, as its going round and round in circles.
I know 2 people who stayed with classic ASP to this day, and it seems MS keeps moving the goal post thereby increasing the learning curve. I wonder what next ?
All-Star
52101 Points
23237 Posts
Re: How do you scaffold controllers for identity pages ?
Sep 05, 2019 05:54 PM|mgebhard|LINK
Again, the ASP.NET Core 2.0 SDK has the template you are looking for.
All-Star
57864 Points
15491 Posts
Re: How do you scaffold controllers for identity pages ?
Sep 05, 2019 07:39 PM|bruce (sqlwork.com)|LINK
you want the following:
https://docs.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-2.2&tabs=visual-studio
see the create full identity ui source. you probably want the identity actions to return json rather than html and use JWT authentication. here is a simple example:
https://jasonwatmore.com/post/2018/08/14/aspnet-core-21-jwt-authentication-tutorial-with-example-api
All-Star
194007 Points
28027 Posts
Moderator
Re: How do you scaffold controllers for identity pages ?
Sep 05, 2019 08:53 PM|Mikesdotnetting|LINK
But the good news is that MS continue to provide support for your classic ASP friends.