HttpHandlers, Server.Transfer and Session State

  • Thread starter Thread starter Fernando Rodriguez
  • Start date Start date
F

Fernando Rodriguez

I created an HttpHandler for rewritting URLs.
It simply checks if the requested page is on a list of "special" pages (that
do not exist) and if it is on the list then it will transfer to an ASPX page
that will generate the content dynamically.

The problem is that after the call to Server.Transfer or Server.Execute the
page i'm transfering to throws an exception when it tries to access the
Session object. The error says that I must set enableSessionState to true on
the page directive or the pages tag on the web.config. Obviously they are
both set to true.

I also implemented IRequiereSessionState on my HttpHandler but it did not
make a difference.

Any suggestions?
 
you are probably doing the transfer before session is loaded. why are you
doing server transfer anyway? why not RewritePath.

-- bruce (sqlwork.com)
 
Thanks. If I use rewrite path it will postback to the page dynamic page url.

The session was already loaded, I tested it before the transfer call.

What I ended up doing was use PageParser to create an instance of the
compiled version of the .ASPX file and then call it's ProcessRequest method.
That's how it's done by the built-in handler.
 
Back
Top