我为什么要搬走使用的HttpContext会话状态的形式在我的ASP.NET MVC应用程序? [英] Why should I move away form using HTTPContext Session State in my ASP .Net MVC applications?

查看:128
本文介绍了我为什么要搬走使用的HttpContext会话状态的形式在我的ASP.NET MVC应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我记得读一对夫妇的乡亲不鼓励在ASP .NET Web应用程序中使用HTTPContext.Current.Session状态的地方。

I recall reading a couple of places that folks are discouraging the use of HTTPContext.Current.Session state in ASP .Net web applications.

有人可以解释一些推理背后近期走势?
是否有坚实的技术原因造成的?

Can someone explain some of the reasoning behind this recent trend? ARe there solid technical reasons for this?

谢谢,
JohnB

Thanks, JohnB

推荐答案

首先,MVC不是web表单,它的目的是成为无国籍人士。

First, MVC is not webforms, it is meant to be stateless.

http://www.wintellect.com/blogs/jprosise/thoughts-on-asp-net-s-new-mvc-framework

其次,MVC是在自然界宁静
http://dotnetslackers.com/articles/aspnet/AnArchitecturalViewOfTheASPNETMVCFramework.aspx
并根据堆栈溢出(笑)会话不是宁静。

Second, MVC is restful in nature http://dotnetslackers.com/articles/aspnet/AnArchitecturalViewOfTheASPNETMVCFramework.aspx and according to stack overflow (lol) sessions are not restful.

难道真的会违反RESTfulness?

三,会议是老同学。你可以对你做一些工作升级你的应用,提高了数据安全性和响应性为好。
每一个HTTP请求到应用程序意味着你的应用程序必须使2个额外的网络请求超出进程内的商店 - 一个加载会话处理请求之前,另一个存储会话请求完成后回去处理
http://brockallen.com/2012/04/ 07 /思两次约-使用会话状态/

Third, session is old school. You can upgrade your application with some work on your part, improve data safety and responsiveness as well. "Each HTTP request into the application means that your application must make 2 extra network requests to the out-of-proc store — one to load session before the request is processed and another to store the session back after the request is done processing" http://brockallen.com/2012/04/07/think-twice-about-using-session-state/

这篇关于我为什么要搬走使用的HttpContext会话状态的形式在我的ASP.NET MVC应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆