Implementing login functionality in asp net core

kudvenkat
kudvenkat
169 هزار بار بازدید - 5 سال پیش - Implementing login functionality in an
Implementing login functionality in an asp.net core application using the asp.net core identity API.

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 implement the login functionality in an asp.net core application, we need
Login View Model
Login View
A pair of Login action methods in the AccountController - HttpGet login Action and HttpPost login Action

LoginViewModel

To login a user, we need their Email which is the username, password and whether if they want a persistent cookie or session cookie.

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

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

   [Display(Name = "Remember me")]
   public bool RememberMe { get; set; }
}

Session Cookie vs Persistent Cookie

Upon a successful login, a cookie is issued and this cookie is sent with each request to the server. The server uses this cookie to know that the user is already authenticated and logged-in. This cookie can either be a session cookie or a persistent cookie.

A session cookie is created and stored within the session instance of the browser. A session cookie does not contain an expiration date and is permanently deleted when the browser window is closed.

A persistent cookie on the other hand is not deleted when the browser window is closed. It usually has an expiry date and deleted on the date of expiry.

For Login View Code and Login Action Methods code
https://csharp-video-tutorials.blogsp...
5 سال پیش در تاریخ 1398/03/21 منتشر شده است.
169,078 بـار بازدید شده
... بیشتر