1、在 Startup 中 ConfigureServices 添加Session

public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddApplicationInsightsTelemetry(Configuration); services.AddMvc();
//添加Session功能
services.AddSession();
}

2、根据提示添加 Session 程序包

3、在 Startup 中 Configure 添加 app.UseSession();

4、简单使用

HttpContext.Session.SetString("sessionkey", "sessionvalue123");
ViewBag.SessionValue = HttpContext.Session.GetString("sessionkey");

最新文章

  1. 谈谈asp.net MVC中的AppendTrailingSlash以及LowercaseUrls ,你还记得吗?
  2. js => ES6一个新的函数写法
  3. CKEditor使用配置方法
  4. target file里面的每个string字段的双引号怎么去掉
  5. 关于Python 获取windows信息收集
  6. asp.net生成缩略图
  7. ubuntu mysql emma中文乱码问题解决
  8. SpringMVC 中的Interceptor 拦截器
  9. openerp学习笔记 自定义小数精度(小数位数)
  10. iOS开发——UI篇OC篇&SpriteKit详解
  11. POJ1365 - Prime Land(质因数分解)
  12. ural 1203. Scientific Conference
  13. Dragon Balls(hdu3635带权并查集)
  14. iOS 架构模式
  15. Android使用ADB命令和stetho查看app数据库
  16. Cookie防篡改机制
  17. 16.python-I/O模型
  18. Golang实现杨辉三角
  19. 【做题】SDOI2017硬币游戏——方程&概念处理
  20. OCIlib的几个函数的执行效率(附上pro*c的性能对比)

热门文章

  1. Hololens文件读写
  2. GIT 代码管理工具 SourceTree
  3. jQuery datepicker和jQuery validator 共用时bug
  4. BIEE基本函数
  5. Information:java: javacTask: 源发行版 1.8 需要目标发行版 1.8
  6. CodeForces 711C Coloring Trees
  7. mysql 时间类型分类
  8. Lua math库
  9. Python数据预处理—训练集和测试集数据划分
  10. HihoCoder