Controlling Session Behavior in Asp.Net MVC4
Posted By : Shailendra Chauhan, 06 Jan 2013
Updated On : 11 Jun 2014
By default, Asp.Net MVC support session state. Session is used to store data values across requests. Whether you store some data values with in the session or not Asp.Net MVC must manage the session state for all the controllers in your application that is time consuming. Since, session is stored on server side and consumes server memory, hence it also affect your application performance.
Session Less Controller
If some of the controllers of your Asp.Net MVC application are not using session state features, you can disable session for those controller and can gain slight performance improvement of your application. You can simplify session state for your application by using available options for session state.
In Asp.Net MVC4, SessionState attribute provides you more control over the behavior of session-state by specifying the value of SessionStateBehavior enumeration as shown below:
In Asp.Net MVC, TempData use session state for storing the data values across requests. Hence, when you will disabled the session state for the controller, it will throw the exception as shown below:
What do you think?
I hope you will enjoy the tips while programming with Asp.Net MVC. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.
最新文章
- TNS-12535: TNS:operation timed out案例解析
- handler内存泄露
- HTTP 错误 500.21 - Internal Server Error
- jQuery实现滚动效果详解1
- zk框架销毁Page上的Component
- users
- 【笨嘴拙舌WINDOWS】字符类型与字符串
- Java学习第四篇:数组,排序,查找
- Entity Framework: Get mapped table name from an entity
- Bolt 动画
- IOS开发-表视图LV3导航控制器
- .bind.apply() 解决 new 操作符不能用与 apply 或 call 同时使用
- Spring3 MVC DispatcherServlet 配置问题
- &;和&;&;的共同点和区别、Java字符含义和Java创建对象的几种方式
- 限制标题字符串的长度,超过长度的截取并加上";...";
- CentOS 7下设置Docker代理(Linux下Systemd服务的环境变量配置)
- Communications link failure due to underlying exception异常处理(转)
- 苹果笔记本 如何配置成php开发系统
- python之virtualenv
- 三星打印机SCX-4824HN全套驱动(打印/扫描)
热门文章
- ubantu 虚拟机无法查看windows共享目录
- MySQL插入中文时出现ERROR 1406 (22001): Data too long for column 'name' at row 1 (转)
- 平均分割list
- 使用nagios插件 check_mysql_health 过程中遇到的error
- windows抓包工具Wireshark(过滤)
- Vue.js:条件与循环
- TIMEQUEST学习之黑金动力(三)
- powerdesigner Oracle.sql转mysql.sql
- RAD 10 新控件 TSearchBox TSplitView
- Spring Cloud Eureka 5 (服务发现与消费-简单的robbin使用)