EEE
EEE

Reputation: 57

Enable session state

I'm using C# asp.net. I have deployed my site to Sharepoint 2010 and after deployment I get an error that says enable session state. I managed to solve this error by adding the following code to web.config file:

    <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
        <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>

and I added this to the page directive:

enableSessionState="true"

Is there a way to add it in the master page? I tried adding enableSessionState="true" but I get this error: Error 10 Error parsing attribute 'enablesessionstate': Type 'System.Web.UI.MasterPage' does not have a public property named 'enablesessionstate' am I doing it wrong? if so, what is the correct way to enable session state in master page?

Upvotes: 2

Views: 2826

Answers (1)

Andre Pena
Andre Pena

Reputation: 59336

You don't want to use the enableSessionState attribute of the Page directive to manipulate session. You use the sessionState element (http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=vs.85).aspx) and only use the pages's one to disable session for a specific Page.

And I'm also not sure why you are disabling the session by removing the Session module (I'm not even sure this will work). You would normallly do it like this:

<sessionState mode="Off" />

Upvotes: 1

Related Questions