HttpHandlers, Server.Transfer and Session State

Discussion in 'ASP .Net' started by Fernando Rodriguez, Apr 27, 2008.

  1. 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?
    Fernando Rodriguez, Apr 27, 2008
    #1
    1. Advertising

  2. Fernando Rodriguez

    bruce barker Guest

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

    -- bruce (sqlwork.com)


    "Fernando Rodriguez" wrote:

    > 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?
    >
    >
    >
    bruce barker, Apr 28, 2008
    #2
    1. Advertising

  3. 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.


    "bruce barker" <> wrote in message
    news:...
    > you are probably doing the transfer before session is loaded. why are you
    > doing server transfer anyway? why not RewritePath.
    >
    > -- bruce (sqlwork.com)
    >
    >
    > "Fernando Rodriguez" wrote:
    >
    >> 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?
    >>
    >>
    >>
    news.microsoft.com, Apr 28, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adrian Bezzina
    Replies:
    0
    Views:
    500
    Adrian Bezzina
    Aug 7, 2003
  2. shamanthakamani
    Replies:
    1
    Views:
    3,461
    Natty Gur
    Nov 20, 2003
  3. Not Liking Dot Net Today
    Replies:
    0
    Views:
    581
    Not Liking Dot Net Today
    Apr 21, 2004
  4. Steve Lutz
    Replies:
    4
    Views:
    5,124
    csmartdalton
    Jul 6, 2009
  5. Maciek
    Replies:
    0
    Views:
    8,211
    Maciek
    Sep 15, 2005
Loading...

Share This Page