Session State, Click Event, and HttpHandler RRS feed

  • Question

  • User1430299578 posted


     Inside of an httphandler I am using, I need to access a session variable. This is working fine. However, on some pages there is a control which resets the session variable in a click event. However, I need this value in the httphandler code. What's happening is it is one click behind, in that you have to click the button twice for the httphandler to pick it up. I guess this is because the click is a postback and not a new request. Anyway to get around this without using a response.redirect?


    Tuesday, July 31, 2007 6:44 AM

All replies

  • User1622957740 posted

    Are you implementing IRequiresSessionState on your handler?

    Without this there will be no session state available to your handler.

    There should be no issue 'sharing' session state between page and handler - it's all going agains the same store.

    +++ Rick ---

    Wednesday, August 1, 2007 9:52 PM
  • User1430299578 posted


    Yes I am, and I do indeed have access to session state. However, the issue is that I have a user control which has a click event on a button. Inside the click event I am resetting the session variable. After postback, the session value is still set to the old value. If I refresh the page, or cause another postback then the new session value is set. If I remove the httphandler everything works as expected. Not sure why this is happening.


    Thursday, August 2, 2007 6:25 AM
  • User1430299578 posted

     Anyone? Really stuck on this one.

    Thursday, August 2, 2007 8:50 PM