11 October 2015

SharePoint Provider Hosted App Model apps - Session Storage

If you are planning to use sessions in your SharePoint Provider Hosted App model applications (ASP.NET Web App, ASP.NET MVC), please ensure to use Session-mode as ‘SqlServer’.

Default mode of Session in ASP.NET is ‘InProc’  which will work fine only in Single Server environment.

For Web-farm environment, we need to use  Session-mode as either ‘StateServer’ or ‘SqlServer’.

In StateServer mode, sessions are stored in one of the servers in Web-farm. But this server may go down and our application will not work.

Hence recommended approach is to use ‘SqlServer’ mode where sessions are stored in SQL-Server database.

Also we need to ensure that objects stored in session are Serializable otherwise it will not work with StateServer or SqlServer mode.


No comments: