.net6使用session 电脑版发表于:2022/12/20 21:07 ### 先在Program.cs中引入 ![](https://img.tnblog.net/arcimg/notebook/c52c035f20a64dddac726d8a4904a63b.png) ### 使用 存储 ``` HttpContext.Session.SetString("nickname","test"); ``` 读取 ``` string? nickname = HttpContext.Session.GetString("nickname"); ```