ASP.NET 登录后 MVC Core 3.0 在浏览器后退按钮单击时再次显示登录页面

ASP.NET MVC Core 3.0 after login shows login page again at the browser back button click

一旦用户登录并按下后退按钮,用户就需要再次登录。我想解决这个问题。任何人都可以知道吗?

//startup.cs
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(options=>
{
     options.Cookie.Name = "Dementia.Cookie";
     //options.EventsType = typeof(Infrastructure.Persistance.GenericUser);
     options.LoginPath = "/Home/Login";
     options.LogoutPath = "/Home/Logout";
     options.ExpireTimeSpan = TimeSpan.FromMinutes(5); //TimeSpan.FromDays(1);
     options.SlidingExpiration = false;             
});

 //Controller
 [Authorize]
 [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
 public IActionResult Dashboard()
 {
      return View();
 }

我已手动存储在 cookies 控制面板中 url 并验证其工作正常的身份。

 var claims = new[] {
                        new Claim(ClaimTypes.Name, userInfo.Name),
                        new Claim(ClaimTypes.Role, userInfo.Category),
                        new Claim(ClaimTypes.Uri, "/Home/Dashboard"),
                        new Claim("UserId", userInfo.UserId),
                        new Claim("Id", userInfo.Id)};

public IActionResult Login()
    {
        if (HttpContext.User.Identity.IsAuthenticated)
        {
            return Redirect(HttpContext.User.FindFirst(ClaimTypes.Uri).Value);
        }
        return View();
    }