SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Normally session state module is disabled in SharePoint web.config. So it means SharePoint don't need session at all for its functioning.

Is it bad practice to enable session state in SharePoint web.config? I am developing a webpart and storing some values in session like Session["key"]=value;

share|improve this question

as sharepoint is made from, I would assume its an intergral part of sharepoint. There are other methods other than session state that you can use depending on your criteria. Session state can also hinder on performance or result in application errors if used inappropriately and will allow you to properly clear the session state.

I had an issue where I needed to keep track of annonymous users input on a page and after multiple postbacks... viewstate which didnt work and so I had to use session state but didnt want to use cookies.

to better understand session state like ttl (time to live) which i think is 20 min depending on the user not using the session again, security and most of all performance... msdn would be the best place (links below).

sharepoint does use session state, just not the form you know of ;)

Session State Providers

for the understanding and all your answers on session state and sharepoint:

to create a session state:

How to save variables per user session per page

the above link is my answer to using session state! its simple and easy and reusable :)

about session states

share|improve this answer
my question is whether to turn on the session state in SP is a good practice or not – SP.NET Apr 3 '13 at 11:07
as iv noted that its good practice to turn it on if your going to use it as its per web.config! its not going to cause any hindering in resources, it just means that functionality is enabled. Only have it on if your going to use the session state in the webapp! – ali Sharepoint Apr 3 '13 at 11:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.