Chr*_*ein 2 asp.net session httphandler
我正在尝试设计一个解决方案,它将模拟App_Offline.htm进行远程访问,但仍允许本地用户测试网站.我找到了一些我正在尝试的各种选项,但最好的选项似乎不适用于我们的ASP.NET(2.0)站点,它依赖于在所有页面上启用会话状态.
HttpHandler被添加到web.config中
<add verb="*" path="*.aspx" type="AppOffline.AppOfflineHandler, AppOffline" />
Run Code Online (Sandbox Code Playgroud)
当课程被调用时,归结为:
public void ProcessRequest( HttpContext context )
{
this.context = context;
// offline mode and remote request?
if ( !context.Request.IsLocal &&
IsOffline
)
{
context.Response.Clear();
context.Response.Write( AppOffline );
context.Response.End();
}
else
// redirect to the default processing pipe
PageParser.GetCompiledPageInstance(
context.Request.Path,
context.Request.PhysicalPath,
context ).ProcessRequest( context );
}
Run Code Online (Sandbox Code Playgroud)
问题出在PageParser.GetCompiledPageInstance中.我现在在我们网站上点击的任何页面都会收到以下错误消息:
"只有在配置文件或Page指令中将enableSessionState设置为true时才能使用会话状态.还请确保<configuration>\<中包含System.Web.SessionStateModule或自定义会话状态模块应用程序配置中的system.web>\<httpModules>部分."
我们将所有会话变量都存储在SQL中,不确定是否存在因素.
我见过其他有类似错误的人,他们得到的答案是你需要添加ProcessRequest(上下文)来解决它.
想法,意见,建议?
谢谢.