How to optimize session state in asp.net?

InfoPath alternatives for form designing SharePoint

In this post we will discuss how to optimize session state in asp.net. As sessions are stored in the sever so it is very much important to optimize session, so that performance will be better.

You can also check out my previous posts on: Anonymous Types in C#.Net , Working with enterprise library for data access in asp.net Part-3 and RegularExpressionValidator example in Asp.Net.

– If no session is required for the application then make the session state mode as off in the web.config file like below:

<SessionState Mode=”off”/>

When session state mode is off, Session will not be created for the client request. This will improve the performance of the web server.

– Suppose in a page you need only to read session then try to implement page level session like below:

<% @ Page ……. EnableSession=”ReadOnly” %>

– In a pag if you do not need session then disable the session like below:

<% @ Page ……. EnableSession=”False” %>

– If you need read and write to session then enable the session for the page.

<% @ Page ……. EnableSession=”True” %>

This way you can make some optimization of the session.

Similar SharePoint 2013 Tutorials


About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →

Leave a Reply