Saturday, February 7, 2009

Limitation of enabling session state

By default in Sharepoint session state is disabled. when you open any site collection web.config file you will see below line commented in http module
'add name="Session" type="System.Web.SessionState.SessionStateModule" '
The difference between session state in sharepoint and .net
In .net session can be enabled at page level. So the pages which doen't have the session can avoid the performance hit associated with it.But in sharepoint once the sessionstate is enabled for the application, all the the unghosted(customized) page forced to use sessionstate whether or not controls on that page require session state.
For ex: Assume your SharePoint server contains mostly unghosted pages. Let’s say there are 1000 unghosted pages on the site. You create a web part that requires session state. Let’s say that web part is only used on a few select pages (i.e. 2-3 pages). Enabling session state so that 2-3 pages can use the web part suddenly slows down the performance of the 998 other pages.SSo it is advisable not to use session state in sharepoint which degrades the performance of the application

No comments: