How to Enable Session State in SharePoint 2013 Development Environment


Sathish Nadarajan
SharePoint MVP
Published On :   26 May 2015
Visit Count
Today :  1    Total :   16091
Plan, Migrate, Secure, Report
SharePoint & Office 365 Tool. Simple & Easy to Use. 15-Day Trial!

SharePoint Office 365 Tool
Simple & Powerful Tool for Migration, Security & Reporting. Free Trial


In one of the MSDN Blog, a clear explanation about the SharePoint Context Class and the new methods used in Visual Studio 2013 to retrieve the Client Context. If we have a close look at the methods, then we could see that, Session has been used for storing and retrieving the context objects.

By default the session state will not be enabled on the SharePoint Development Environment. To make our Provider Hosted App work properly, we need to enable the Session State.

For that, we need to make the changes on both the web.config of the SharePoint Site as well as your Provider Hosted App’s web.config.

Let us see the changes. They are very simple.

<system.web>

<pages enableSessionState="true" />

</system.web>

After doing this, one important thing is, on the SharePoint Farm level, we need to enable the session. For that, execute the below PowerShell Script.

Enable-SPSessionStateService -DefaultProvision

And make sure the below Service is running.

image

Happy Coding,

Sathish Nadarajan.

SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Categories

Migratiin Tools for SharePoint