How to Enable Session State in SharePoint 2013 Development Environment

Sathish Nadarajan
 
Solution Architect
May 26, 2015
 
Rate this article
 
Views
28847

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.

Category : SharePoint

Author Info

Sathish Nadarajan
 
Solution Architect
 
Rate this article
 
Sathish is a Microsoft MVP for SharePoint (Office Servers and Services) having 15+ years of experience in Microsoft Technologies. He holds a Masters Degree in Computer Aided Design and Business ...read more
 

Leave a comment