K
Kevin
Has anyone ever encountered this problem? (I searched on google for
past posts but didn't find anything)
I have a class implementing the IHttpModule Interface. It's mainly
used for seting up layout information & provide some security/logging
functions. Typically it inspects a HttpRequest, set some variables
into session, and returns.
for exactness, the HttpModule is hooked up to these events
PreRequestHandlerExecute
PostRequestHandlerExecute
The strange thing is, depending on the content of the ASPX page that
the Http Request is for, sometimes HttpContext.Session is not
available for the HttpModule.
It turns out that if the targeted aspx page does not have any
code-behinds or scriptlet blocks.. or any code whatsoever. ASP.Net
creates a handler object for that request/aspx page which does not
implement IRequiresSessionState interface, hence no session.
Now that is fine since you would never need to access session info
from an aspx page that contains no code. But in my case.. the
HttpModule DOES..
So, given the problem stated.. I thought the way to solve it would be
override Page class and implement the IRequreSessionState Interface in
a new class.
specify the pageBaseType attribute in the pages directive under
web.config to the new class.
and of course it didn't work!! Can anyone suggest anything else?
(other than adding a code block to every single aspx page) or at least
explain why my work around is futile.
Any input will be greatly appreciated.
Thanks!
past posts but didn't find anything)
I have a class implementing the IHttpModule Interface. It's mainly
used for seting up layout information & provide some security/logging
functions. Typically it inspects a HttpRequest, set some variables
into session, and returns.
for exactness, the HttpModule is hooked up to these events
PreRequestHandlerExecute
PostRequestHandlerExecute
The strange thing is, depending on the content of the ASPX page that
the Http Request is for, sometimes HttpContext.Session is not
available for the HttpModule.
It turns out that if the targeted aspx page does not have any
code-behinds or scriptlet blocks.. or any code whatsoever. ASP.Net
creates a handler object for that request/aspx page which does not
implement IRequiresSessionState interface, hence no session.
Now that is fine since you would never need to access session info
from an aspx page that contains no code. But in my case.. the
HttpModule DOES..
So, given the problem stated.. I thought the way to solve it would be
override Page class and implement the IRequreSessionState Interface in
a new class.
specify the pageBaseType attribute in the pages directive under
web.config to the new class.
and of course it didn't work!! Can anyone suggest anything else?
(other than adding a code block to every single aspx page) or at least
explain why my work around is futile.
Any input will be greatly appreciated.
Thanks!