How to Enable Session State in SharePoint 2013 Development Environment

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

Sharegate: Kick-Ass Tool
Think Your SharePoint & Office 365 Are Secure ? Find Out Now!

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.


<pages enableSessionState="true" />


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.


Happy Coding,

Sathish Nadarajan.

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

Protect Your SharePoint