.net core 2.2中HttpContext.Current.Session [key]的替换是什么。请提供一些示例代码示例
答案 0 :(得分:1)
// Requires: using Microsoft.AspNetCore.Http;
HttpContext.Session.SetString(SessionKeyName, "The Doctor");
HttpContext.Session.SetInt32(SessionKeyAge, 773);
var name = HttpContext.Session.GetString(SessionKeyName);
var age = HttpContext.Session.GetInt32(SessionKeyAge);
希望有帮助。