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.
And make sure the below Service is running.