ASP.NET Razor Pages

ASP.NET Razor

Authentication is the most important part of every application. Now we use the technology of asp.net Razor pages to develop an application .now needed to add authentication feature into the app so we choose the simple or easy way to develop a authenticate app securely.
 now describe below,
Create a project from scratch.
ASP.NET Razor

ASP.NET Razor

ASP.NET Razor

ASP.NET Razor

ASP.NET Razor

ASP.NET Razor

now complete code block is here
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;

namespace Authentication.Pages
{
    public class LoginModel : PageModel
    {
        public void OnGet()
        {

        }
        [BindProperty]
        [Required]
        [Display(Name = "Email")]
        public string Email { get; set; }
        [BindProperty]
        [Required]
        [DataType(DataType.Password)]
        public string Password { get; set; }
        public async Task<JsonResult> OnPost(string Email, string Password)
        {
            try
            {
                var isValidUser = Email == "shadab33@hotmail.com" && Password == "111111";
                if (isValidUser == null)
                {
                    ModelState.AddModelError("", "Invalid user");
                }

                if (!ModelState.IsValid)
                {
                    return new JsonResult("false");
                }

                var scheme = CookieAuthenticationDefaults.AuthenticationScheme;
                var AuthUser = new ClaimsPrincipal(
                    new ClaimsIdentity(
                        new[] { new Claim(ClaimTypes.Name, Email) },
                        scheme
                        )
                    );

                await HttpContext.SignInAsync(scheme, AuthUser);
                return new JsonResult("true");
            }
            catch (DbUpdateConcurrencyException ex)
            {
                throw ex;
            }
        }
    }
}
and Html code here 

@page
@model Authentication.Pages.LoginModel
@{
    ViewData["Title"] = "Login";
}

<h2>Login</h2>

<form method="post">
 <input type="text" placeholder="Email" name="Email" id="Email" autocomplete="off">
 <input  type="password" placeholder="Password" id="Password" name="Password">
<button type="submit">Sign In </button>
</form>

now authentication is complete code is done 

if you can learn about Asp.net MVC.
and if you can learn about Asp.net Razor pages