I'm trying to fashion a solution which will simulate App_Offline.htm for remote access but still开发者_C百科 allow local users to test the website out. I found some various options that I am trying out but the best one doesn't seem to work for our ASP.NET(2.0) site which relies on session state being enabled on all of the pages.
The HttpHandler is added into web.config
<add verb="*" path="*.aspx" type="AppOffline.AppOfflineHandler, AppOffline" />
and when the class is called, it boils down to this:
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 );
}
The problem is in PageParser.GetCompiledPageInstance. Any page that I hit now within our website I get the following error message:
"Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the < configuration>\< system.web>\< httpModules> section in the application configuration."
We have all of our session variables stored within SQL, not sure if that factors into it or not.
I've seen other people who have had similar errors and the answer they were given was that you needed to add the ProcessRequest(context) to get around it.
thoughts, comments, suggestions?
thanks.
Did you implement IRequiresSessionState
in your handler?
精彩评论