启用/每个控制器/操作方法禁用会话状态

启用/每个控制器/操作方法禁用会话状态

问题描述:

我们正在建立,这将被部署背后支持,除其他事项外的硬件负载平衡器ASP.NET MVC应用程序,高速缓存。

We are building an ASP.NET MVC application which will be deployed behind a hardware load balancer that supports, among other things, caching.

我们的建议是手动定义哪些URL模式应该由负载平衡器缓存。这将是对我们相当一个简单的过程,因为我们有目录页面,这是相对静态的,然后'秩序'的网页,哪些不是。

Our proposal is to manually define which URL patterns should be cached by the load balancer. This will be quite an easy process for us as we have 'catalogue' pages which are relatively static, then 'order' pages which are not.

必须避免使用缓存的网页会话状态,因为整个响应由负载平衡器缓存 - 这包括发送任何cookie

Must avoid using session state on cached pages, as the entire response is cached by the load balancer - this includes any cookies that are sent.

理想情况下将有可施加到控制器或动作方法,它允许有选择地使用会话状态的属性,但也不会出现是一个。我认识到,这样的做法将导致丢失的会话,如果使用离开会话区' - 这很好

Ideally there would be an attribute which can be applied to controllers or action methods which allows selective use of session state, but there doesn't appear to be one. I realise that an approach like this would result in lost sessions if the use leaves the 'session zone' - that's fine.

除了重新实现整个ASP.NET MVC的HTTP的控制器...有什么建议?

Other than re-implementing the entire ASP.NET MVC HTTP controller... any suggestions?

先谢谢了。

这是包含在MVC 2期货。见的http://blogs.msdn.com/rickandy/archive/2009/12/17/session-less-mvc-controller.aspx获取更多信息。

This is included in MVC 2 Futures. See http://blogs.msdn.com/rickandy/archive/2009/12/17/session-less-mvc-controller.aspx for more info.