Register new user using asp net core identity

kudvenkat
kudvenkat
158 هزار بار بازدید - 5 سال پیش - How to register new user
How to register new user using asp.net core identity framework

Text version of the video
https://csharp-video-tutorials.blogsp...

Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.
@aarvikitchen5572

Slides
https://csharp-video-tutorials.blogsp...

ASP.NET Core Text Articles & Slides
https://csharp-video-tutorials.blogsp...

ASP.NET Core Tutorial
ASP.NET core tutorial for beginners

Angular, JavaScript, jQuery, Dot Net & SQL Playlists
https://www.youtube.com/user/kudvenka...

To be able to register as a new user we need an email address and password.

RegisterViewModel Class

We will use this RegisterViewModel Class as the model for Register view. It carries the information from the view to the controller class. For validation we are using several asp.net core validation attributes. We discussed these validation attributes and model validation in detail in Parts 42 and 43 of this video series.

public class RegisterViewModel
{
   [Required]
   [EmailAddress]
   public string Email { get; set; }

   [Required]
   [DataType(DataType.Password)]
   public string Password { get; set; }

   [DataType(DataType.Password)]
   [Display(Name = "Confirm password")]
   [Compare("Password",
       ErrorMessage = "Password and confirmation password do not match.")]
   public string ConfirmPassword { get; set; }
}

HttpGet Register action in AccountController

All the user account related CRUD operations will be in this AccountController.
At the moment we just have the Register action method
We reach this action method by issuing a GET request to /account/register

using Microsoft.AspNetCore.Mvc;

namespace EmployeeManagement.Controllers
{
   public class AccountController : Controller
   {
       [HttpGet]
       public IActionResult Register()
       {
           return View();
       }
   }
}

Register View

Place this view in Views/Account folder
The model for this view is RegisterViewModel which we created above

For the Register View HTML please refer to our blog at the following link
https://csharp-video-tutorials.blogsp...

In our next video we will discuss
Implementing Register action that handles HttpPost to /account/register
Create a user account using the posted form data and asp.net core identity
5 سال پیش در تاریخ 1398/03/14 منتشر شده است.
158,009 بـار بازدید شده
... بیشتر