Click here to Skip to main content
15,907,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

This is the error

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpmodules> section in the application configuration.

Help Me
Updated 4-Apr-13 2:32am
ZurdoDev 4-Apr-13 8:32am    
The error tells you that you are trying to use the Session but it is turned off.

Try Enabling SessionState for your Application. Refer the link below:
How to enable Session state in ASP.NET[^]

Share this answer
1. Enable the ASP.NET Session State Manager Service (under Control Panel > Administrative Tools > Services)

2. Enable it in the web.config file: <pages enableSessionState="true">

3. Add the proper http module to the web.config: <add name="Session" type="System.Web.SessionState.SessionStateModule" />

4. At last but not least: Make sure you're accessing the Session object after it has been initialized. This is very important, since if you try to manipulate it in the page constructor, for example (which was my case), you'll still get the above exception, even after executing steps 1, 2 and 3. You should be able to access it after the page OnLoad event has been fired.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900