在最上面加一个私有的方法async
Login的post方法。加入returnUrl的参数post
登录界面也须要加上测试
asp-route-returnUrl="@ViewBag["ReturnUrl"]"spa
public async Task<IActionResult> LoginOut() { //HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); await _signInManager.SignOutAsync(); return RedirectToAction("Index", "Home"); }
登录和注册都写完了3d
修改好退出的代码之后,就能够正常的的退出了。code
输入地址:blog
https://localhost:44347/adminit
会自动跳转到:io
https://localhost:44347/Account/Login?ReturnUrl=%2Fadminclass
输入帐号和密码进行登录
登录后,就根据returnUrl跳转到了admin的页面