How To

How To Work With Sessions in ASP.NET

HTTP is a stateless protocol, which means every moment when a new request is made by the client for the server, the state information of the previous request is lost.

There are many methods to store and handle state in and Session object is among those methods. Caching and Application objects are other objects used for same job.

Caching helps in enhancement of the app performance by lowering the consumption of resources in the system.


You can store rapidly used data or web pages in order to enhance the performance, output and scalability of the application by reducing the consumption of the resources of the server.

A Session in is a session of connectivity between the client and the server. It is the Session object that holds data that communicate to a users’ session. It is a server side state management technique used for storing user centric information into memory for future recovery.

Methods of Storing Session Data

There are four methods to store session data

  1. In process
  2. SQL Server
  3. State Server
  4. Custom
  • In process method stores data in the same process.
  • SQL Server process stores data in the SQLServer database.
  • State Server method stores data in some other system.
  • Custom method allows you to store session data with a custom storage provider.

New Session data compression support 4 has a new feature – session state compression. Developers can leverage this feature in 4 and updated version to compress session data in order to store out-of-process sessions.

They need to set the compressionEnabled attribute to “true” in the app configuration file. Take an example:


Session state allows developers to store user centric data to the memory and recognize a specific request in unique way. It can be stored as key/value and can be accessed with HttpContect.Session property.


Professional .Net Developer just shared a blog about Sessions to make you understand about their working in If you have any doubt or want to ask anything related to Sessions or, just comment in below section.

wireless router setup
How To Xfinity Default Wireless Router IP Address
Business Promotion
How To Advertise Your Business Cheaply or For Free
How to Configure Router
How to Configure Your Router for a Cable Internet Connection
Public WiFi
How To Protect Yourself While on Public WiFi
call center services
Customer Engagement Solutions Through Inbound Call Center Services
10 Things You Didn’t Knew Chromecast Could Do
Protect Your Identity
How To Protect Your Identity When Playing Games Online
Evolution of Sharing Economy
Top 8 Factors That Rules The Evolution of Sharing Economy
Android Photo Management Applications
Top 10 Android Photo Management Gallery Applications
How To Build Android Apps With Tool
Top 10 Best Android Sports Apps on Google Play
Top 10 Unforgettable Android Party Apps
Swift for iOS
Benefits of Swift language for iOS
iOS 11 Release Date
iOS 11 Release Date, News, Features, Updates & Rumours
Top Travel Apps That iOS Users Must Use At Least For Once
iPhone Apps. Vs Android Apps
Xiaomi Mi6 Reviews
Xiaomi Mi6 Release Date, Controversy and Features of Xiaomi Mi 6
Samsung Galaxy S8
Samsung Delays Galaxy S8 Release Date
Should You Purchase MI Mobile Phones?
Samsung Galaxy Note 5 Flip Case
5 Elegant and Modern Samsung Galaxy Note 5 Flip Case
Improve Online Presence
How Design Agency Help To Improve Online Presence?
Best eCommerce Platform
How To Choose The Best eCommerce Platform
Java browser plug-in Development
How Java was Used in Java browser plug-in Development!
Web Development Trends
5 Web Development Trends That Will Affect Each One of Us in 2017
Wordpress Blog
How WordPress as a Blog Important!
Secure Wordpress Hosting
How Secure WordPress Hosting Helps To Secure a WordPress Site from Hackers!
Detect Malwares and Viruses: Ways to Scan WordPress Plugins and Themes
Optimizer WordPress Theme: An Advanced WP Theme for Live Editing
Quality Backlinks
Why is link building vital?
Quality Backlinks
How To Build Quality Backlinks for Free
SEO Friendly Content
7 Smart Ways to Arch User Friendly SEO Content
5 Important Facts You Should Know About Digital Marketing