Page.EnableSessionState相当于在ASP.NET MVC

编程入门 行业动态 更新时间:2024-10-19 16:37:08
本文介绍了Page.EnableSessionState相当于在ASP.NET MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用ASP.NET的WebForms,可以设置会话状态模式在页面指令:

With ASP.NET WebForms it is possible to set the session state mode in the page directive:

<%@ Page EnableSessionState="true|false|ReadOnly" %>

在ASP.NET MVC(例如每个控制器或每个动作)是相同的配置也是可能的,如果是这样,怎么样?

Is the same configuration also possible in ASP.NET MVC (e.g. per controller or per action) and if so, how?

(换句话说:我可以禁用或设置为只读,每控制器/动作我认为有会话状态会话状态的读/写会导致一些开销,因此,如果会话状态可以把它可能是有益的关闭,如果不是必需的。)

(In other words: can I disable or set to read-only session state per controllers/actions? I assume having the session state read/write will result in some overhead, so it might be useful if session state could be turned off if not required.)

推荐答案

这似乎与ASP.NET MVC 3将有可能拥有会话少控制器,例如看ScottGu's博客文章或this基思·达尔比发布。

It seems that with ASP.NET MVC 3 it will be possible to have session-less controllers, e.g. see ScottGu's blog post or this post by Keith Dahlby.

更多推荐

Page.EnableSessionState相当于在ASP.NET MVC

本文发布于:2023-11-03 15:28:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555451.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:EnableSessionState   Page   ASP   MVC   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!