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;

1 Answer 1


as sharepoint is made from asp.net, 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 asp.net session states


  • my question is whether to turn on the session state in SP is a good practice or not
    – SP.NET
    Commented Apr 3, 2013 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 Jafer
    Commented Apr 3, 2013 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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