Know what you are putting in Session

Session state is one of the important thing that differentiates the static html pages with server rendered pages. Following checklist can be maintained while deciding to put something in session

  1. Understand that Session state should only be used to store session related data, unlike caching where we can store it until the application is restarted.
  2. Always keep the information that is relavent to that session of the user like user login credentials, authorization list and application related information relavent and frequently used during the lifetime of that session.
  3. Use one huge string to store multiple smaller values using a delimiter, than storing them under different names.
  4. Avoid putting complete business objects in session as it will hog the system resources slowing down the server. If something has to be persisted through out the application lifetime, cache them.
  5. Use options like InProcess session management, StateServer or SQL server effectively based on the size of applications.

Make your application robust and fast by handling sessions better.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.