在mvc中使用会话状态? [英] Working with session state in mvc ?

查看:82
本文介绍了在mvc中使用会话状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在mvc应用程序中使用会话状态是一个好主意,如果它在mvc模式和性能方面有一些问题

is it a good idea to work with session state in mvc application and if it has some issues in mvc pattern and preformance

推荐答案

是的,它是一个很好的这个概念,因为形式状态或应用程序状态是Web表单中的较低级别。它与IIS(以及Web标准)绑定良好,您有几种可能性来定制它 [ ^ ]满足您的需求。顺便说一下,你手上没有别的东西让你的应用程序状态良好。因此它与MVC模式或ASP.NET MVC本身无关。如果您查阅管道,您可以看到Web表单,网页和mvc都依赖于asp.net框架。会话处理在该级别进行管理。

只是一个建议:请记住,在构建控制器时,会话状态不可用。如果你需要这样的东西,你将不得不使用IoC或覆盖初始化 [ ^ ]方法。
Yes, it is a good idea, as this one is lower level as form state or application state was in web forms. It is well bound with IIS (and the web standards also), and you have several possibilities to tailor it[^] to your needs. And by the way you have nothing else in the hand to make your application "statefull". Thus it has nothing to do with the MVC patterns or ASP.NET MVC itself. If you consult the pipeline, you can see that both web forms, web pages and mvc relies on asp.net framework. Session handling is managed at that level.
Just an advice: keep in mind, that session state is not available at the time of the construction of a controller. If you need something like this, you will have to use IoC or override Initialize[^] method.


这篇关于在mvc中使用会话状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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