.net core 中不能直接使用session ,
1.下载安装Microsoft.AspNetCore.Session 包
2.在Startup.cs中的ConfigureServices方法添加services.AddSession();
3.在Configure方法中添加app.UseSession();
之后就可以使用了,如
HttpContext.Session.SetString("code","123456");
.net core 中不能直接使用session ,
1.下载安装Microsoft.AspNetCore.Session 包
2.在Startup.cs中的ConfigureServices方法添加services.AddSession();
3.在Configure方法中添加app.UseSession();
之后就可以使用了,如
HttpContext.Session.SetString("code","123456");