如何关闭会话状态的某个目录? [英] How to turn off session state for a certain directory?
问题描述
我有一个数据库中存储数据的自定义会话提供,所以取会话状态不是一个便宜的操作。我也有 runAllManagedModulesForAllRequests =真正的
在我的的web.config
,所以会话inicialized的每个请求的图像
I have a custom session provider that stores data in a DB, so fetching session state is not a cheap operation. I have also runAllManagedModulesForAllRequests="true"
in my web.config
, so sessions are inicialized for every request to an image.
所以,我争取关闭会话状态与静态资源目录。不幸的是,设置<的sessionState模式=关/方式>
的文件夹不起作用,因为这是应用级选项
So, I am striving for turning off session state for directories with static resources. Unfortunately, setting <sessionState mode="Off" />
for a folder does not work as this is application-level option.
我可以在我的自定义会话提供的code处理这个问题,但我想知道如果有一些更清洁,更声明的解决方案。
I could handle this in the code of my custom session provider, but I am wondering if there is some cleaner, more declarative solution.
编辑:&LT;页面ENABLESESSIONSTATE =FALSE/&GT;
似乎并没有帮助,因为它可能涉及到的ASP.NET页面和控件
<pages enableSessionState="false" />
does not seem to help as it is probably related to ASP.NET pages and controls only.
推荐答案
我不认为这是可能的,想想作为会议是为整个应用程序,而你只是可以在这个文件夹我有和说我不这样做,你可以做的是自定义的code服务提供商的代价高昂的操作无法运行,根据一定的条件下,地方,正确地在你的页面生命周期。
I don't think that is possible, think about it as session is provided for the whole application, and you just can say at this folder i have and at that i don't, all you can do is to custom code the costly operation of your provider to not run according to certain conditions, place that correctly in your page life cycle.
这篇关于如何关闭会话状态的某个目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!