1
votes

We are developing a solution based on SharePoint 2013 Foundation. There is a new Distributed Cache service available in SharePoint 2013. When we checked the web.config for a new sample SharePoint web application, we found it was configured to use "In-proc" mode for storing session-state. Can we leverage this distributed cache service to store session state?

Also I saw powershell cmdlets for configuring session state in database in the following msdn article : http://technet.microsoft.com/en-us/library/ee890113.aspx. Is database a preferred way to store session state rather than Distributed Cache for SharePoint 2013?

Are there any other alternatives also available to store session state in SharePoint 2013?

1

1 Answers

1
votes

Usually you will have to use the SharePoint Session State Service by using the Enable-SPSessionStateService PowerShell cmdlet from the article you linked to.

The SharePoint Distributed Cache Service is meant for Cacheable items, especially the Feed, Login Tokens and App Tokens. I did not see an implementation for a Session State Provider. There is a nice explanation about the distributed cache service here:

The service depends on Azure or more specifically on the AppFabric caching infrastructure. You can implement your own stuff to access this Caching framework as explained here:

As said previously, SharePoint uses the Session State Service, which in turns uses standard ASP.NET session state:

As you said correctly the default mode for the state service is set to In-Proc (in memory). What you would normally do is set it to SQLServer so the Session state is saved to some database and can be retrieved by multiple servers. The PowerShell cmdlets you linked in your post do that automatically for you.

So in short: By implementing your own ASP.NET Session State Handler you could circumvent the normal SharePoint State service and leverage the Distributed Cache, however that won't be easy and maybe it is easier to just use a State database.