Thursday, December 11, 2008

State Management in Asp.Net

Server side state management (Part-3)

In this type state information will be stored on the server side.

1. Application state: It is used to store application specific information. This is stored in the server memory. Information stored in application state is common to all users and all sessions. Generally data which does not change often is stored in the application state.

Advantages:
a) As it is common all sessions we can keep a single copy.
b) Easy to implement
Disadvantages:
a) We lose data stored in application state when the web server process Containing it is destroyed.
b)As values stored in application state is particular to one process other
Processes can’t use those values.
c) As it requires server resources it may effect the performance of the server
And the scalability of the application

2. Session State: It Contains Session specific information that needs to be maintained between multiple page requests and server round trips. A session starts when the user enters in to the web site and session ends when he/she leaves the web site( which is called user’s. session). So, Session state object is used to maintain that particular session values. If there are multiple users for a web site then each one will have their own session. Generally session state is used to store data which is sensitive and which changes frequently. It can configured in web.config file.

Advantages:
a)Easy to implement
b)Session state is suitable for multi computer and multi process settings.
c) We can use session with cookies or without cookies
Disadvantages:
a)As it is specific to a particular user session we need to maintain multiple Sessions for multiple users.
b)As it requires server resources it may effect the server performance.


3. Database support: This is mainly used in cases where you want to store more amount of information. Using this method for each request your application contacts the database.

Advantages:
a) We can store large amount of information
b) It provides more security
c) Using this option we can store data for longer time
d) It provides data consistency
Disadvantages:
a) As this stores state information in database it effects server performance.

1 comment:

Admin said...

Excellant, Excellant... I am getting more idea but i don't want that much deeper because I am not an ASP programmer. I have send the blog address to my friends to get the details If they may be looking for.

Thanks you.

Sherin - The Money Maniac
http://investinternals.blogspot.com