基于原来做的cookie认证的代码:MvcCookieAuthSample
增加登陆和退出的方法:
增加Login和SignIn这两个Action方法。
在Views下面创建Account文件夹,然后在里面创建两个视图页面。
我是赋值下面的Privacy.cshtml页面到Account文件夹。然后改了名字为Register.cshtml和Login.cshtml这两个视图页面。
创建文件夹:ViewModels
再创建RegisterViewModel.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace MvcCookieAuthSample.ViewModels { public class RegisterViewModel { public string Email { get; set; } public string Password { get; set; } public string ConfirmPassword { get; set; } } }