Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

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

http://msdn.microsoft.com/en-us/library/aa478952.aspx

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

http://msdn.microsoft.com/en-us/library/ff648090.aspx

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

http://www.aspnet101.com/2010/10/asp-net-session-state-best-practices/

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

 
discard

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.