Reputation: 1299
I am trying to do a simple HttpHandler that checks some things (security - though this is unimportant) and continue on to the page. It should be simple, but I obviously have 1 or both parameters to GetCompiledPageInstance incorrect:
public void ProcessRequest(HttpContext context)
{
if (CheckAccess(context))
PageParser.GetCompiledPageInstance(context.Request.Path, context.Request.PhysicalPath, context);
}
public bool IsReusable { get { return false; } }
private bool CheckAccess(HttpContext context)
{
return true;
}
This is a website, not application, though I don't think that makes a difference.
When I add the handler code to the web config
<add name="SecurityHandler" verb="*" path="*.aspx" type="SecurityHandler" />
Now I get an error that I did not get prior to adding it (no other changes):
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 \\ section in the application configuration.
Never mind. Found the answer to this 2nd part: Problem with HttpHandler and session state
implement IRequiresSessionState in the handler
Upvotes: 0
Views: 1174
Reputation: 48279
Try:
PageParser.GetCompiledPageInstance(context.Request.Path, context.Request.PhysicalPath, context )
.ProcessRequest( context );
Upvotes: 1