if (result > 0) { TempData["UpdateSuccess"] = true; return RedirectToAction(nameof(Index)); }
TempData["UpdateSuccess"] 是Null
试试 stackoverflow 上的一个方法:
After Migrating to ASP Core 2.1 I had this issue and after working for a day find the solution:
in Startup.Configure() app.UseCookiePolicy(); should be after app.UseMVC();
中间件加载顺序问题吗?确实是这样子