添加Session Nuget包

Asp.net core中使用Session

更新Startup.cs文件

在ConfigureServices方法中添加如下代码
services.AddSession(options =>
{
// Set a short timeout for easy testing.
options.IdleTimeout = TimeSpan.FromSeconds(3);
options.CookieHttpOnly = true;
});
在Configure方法中添加如下代码

        app.UseSession();

Asp.net core中使用Session

使用Session

Asp.net core中使用Session

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-16
  • 2022-01-05
  • 2022-03-02
  • 2021-06-02
猜你喜欢
  • 2022-03-09
  • 2022-12-23
  • 2021-10-04
  • 2021-12-14
  • 2021-07-15
相关资源
相似解决方案