From the course: Learning ASP.NET Core MVC

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Use identity services to allow users to log in to your site

Use identity services to allow users to log in to your site

From the course: Learning ASP.NET Core MVC

Start my 1-month free trial

Use identity services to allow users to log in to your site

- [Instructor] Now that users are able to create accounts on our site, let's implement a login page to allow those users to login. Just like before, I'll be copying a premade model and view from the exercise files to get us started. First, there's the model, which I've called Login View Model, and put it in the Models Account folder. If this looks a lot like the register view model from the previous videos, that's because I just copied that register view model and I changed its name. Here's a hint, I did the same thing with the view I'm about to show you as well. And here's the view, where users can submit their user name and password to be authenticated. And finally, back to the account controller, where I'll add a pair of login methods. The identity services helper class I'm going to use to authenticate the user is called sign in manager. So I'll add it to the constructor right alongside its sibling, the user manager. Now I can go back to the login action and call the signin manager…

Contents