Sessionstate is not available in this context in the PreRequestHandlerExecute...

Discussion in 'ASP .Net' started by Sascha Kuhl, Jan 28, 2004.

  1. Sascha Kuhl

    Sascha Kuhl Guest

    I'm working on a piece of code that sets a cookie, depending on the some
    Session State values in the PreRequestHandlerExecute event of my App.

    The code works on my development machine (Windows XP Prof. and IIS 5.0 +
    ..NET Framework version 1.1.4322) as well as on a testsystem running with
    Windows 2003 WebEdition (IIS 6.0 + .NET Framework version 1.1.4322).
    But on 2 other webservers (Windows 2003 IIS 6.0 + .NET Framework version
    1.1.4322), the following exception is raised:
    HttpException: Session State is not available in this context.

    Is my problem perhaps a matter of reconfiguring IIS, the Framework or my
    application? (I've already compared Metabase.xml, web.config and
    machine.config and haven't found any significant differences).

    I made some research on that issue and I found an article telling, "Session
    State is not available in that event (despite MS documentary claims to the
    contrary)":
    http://weblogs.asp.net/acampbell/archive/2003/09/27/29395.aspx
    Can anybody please tell, what to believe?

    Thnx for any post in advance
    Sascha Kuhl, Jan 28, 2004
    #1
    1. Advertising

  2. Your session state should be available in PreRequestHandlerExecute

    http://support.microsoft.com/default.aspx?kbid=307985

    and note
    NOTE: If session state is required in your HTTP handler, you also need to
    implement the IRequiresSessionState interface.

    If its not working check it hasnt been turned off somewhere. (web.config,
    machine.config or the page)
    You may want to put <%@ enableSessionState="true" %> into the page to be
    sure (from memory I think I may have seen some problems with some PC's when
    that wasn't there)

    Andy Mortimer [MS]
    Please do not send email directly to this alias. This alias is for
    newsgroup purposes only

    This posting is provided "AS IS" with no warranties, and confers no rights.
    OR if you wish to include a script sample in your post please add "Use of
    included script samples are subject to the terms specified at
    http://www.microsoft.com/info/cpyright.htm"
    Andy Mortimer [MS], Jan 30, 2004
    #2
    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. MS News \(MS LVP\)

    Re: Response is not available in this context

    MS News \(MS LVP\), Aug 7, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    2,073
    MS News \(MS LVP\)
    Aug 7, 2003
  2. matt
    Replies:
    0
    Views:
    2,158
  3. Natty Gur
    Replies:
    0
    Views:
    2,569
    Natty Gur
    Jun 6, 2004
  4. =?Utf-8?B?VHJldm9yIEJlbmVkaWN0IFI=?=
    Replies:
    0
    Views:
    2,382
    =?Utf-8?B?VHJldm9yIEJlbmVkaWN0IFI=?=
    Jun 7, 2004
  5. Flinky Wisty Pomm
    Replies:
    1
    Views:
    3,358
    Flinky Wisty Pomm
    Feb 13, 2006
Loading...

Share This Page