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

S

Sascha Kuhl

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
 
A

Andy Mortimer [MS]

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"
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top