Design time error, Session state can only be used when enableSessionState is set to true


Hello, i got this error last week, so i wanted to blog about the solution:

The full error is:
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.

Despites the sessionState mode property, enableSessionState property is used to specify whether the session state is enabled. It can be set either in a configuration file or in the Page directive.

1. Page Directive, see if you have enableSessionState set to false.

<%@ Page … enableSessionState=”True” %>

2. Enable session state for all the pages in the Web application in Web.Config file <pages enableSessionState=”true” enableViewState=”true” … />

We have KB on this, you can see more details here: http://support.microsoft.com/kb/307598

add SessionStateModule to system.web section, it should be added tosystem.webServersection.

<system.webServer> <modules> 
<remove name="Session" />
<add name="Session"
type="System.Web.SessionState.SessionStateModule,
System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</modules> </system.webServer>

enjoy 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s