Go Back   Wiki NewForum | Latest Entertainment News > Career Forum & Tips > Tech Forum & Tutorial > ASP.NET Forum & Tutorial


ASP.NET Session state management - Interview Questions


Reply
Views: 4314  
Thread Tools Rate Thread
  #1  
Old 05-31-2009, 04:38 AM
bholus7
Guest
 
Posts: n/a
Default ASP.NET Session state management - Interview Questions

ASP.NET Session state management - Interview Questions


Question - Define Session, SessionId and Session State in ASP.NET.

Answer - A session is the duration of connectivity between a client and a server application.

SessionId is used to identify request from the browser. By default, value of SessionId is stored in a cookie. You can configure the application to store SessionId in the URL for a "cookieless" session.
Question - What is Session Identifier?

Answer - Session Identifier is used to identify session. It has SessionID property. When a page is requested, browser sends a cookie with a session identifier.



This identifier is used by the web server to determine if it belongs to an existing session. If not, a Session ID (120 - bit string) is generated by the web server and sent along with the response.

Question - Advantages and disadvantages of using Session State.

Answer - The advantages of using session state are as follows:
It is easy to implement.


It ensures data durability, since session state retains data even if ASP.NET work process restarts as data in Session State is stored in other process space.



It works in the multi-process configuration, thus ensures platform scalability.


The disadvantages of using session state are:
Since data in session state is stored in server memory, it is not advisable to use session state when working with large sum of data. Session state variable stays in memory until you destroy it, so too many variables in the memory effect performance.

Question - What are the Session State Modes? Define each Session State mode supported by ASP.NET.

Answer - ASP.NET supports three Session State modes.
  • InProc
  • State Server
  • SQL Server
InProc Mode
This mode stores the session data in the ASP.NET worker process.
This is the fastest among all of the storage modes.

This mode effects performance if the amount of data to be stored is large.
If ASP.NET worker process recycles or application domain restarts, the session state will be lost.



State Server mode
In this mode, the session state is serialized and stored in memory in a separate process.

State Server can be maintained on a different system.
State Server mode involves overhead since it requires serialization and de-serialization of objects.

State Server mode is slower than InProc mode as this stores data in an external process.


SQL Server Mode
In this storage mode, the Session data is serialized and stored in a database table in the SQL Server database.

This is reliable and secures storage of a session state.
This mode can be used in the web farms.

It involves overhead in serialization and de-serialization of the objects.
SQL Server is more secure than the InProc or the State server mode.

Reply With Quote
Reply

New topics in ASP.NET Forum & Tutorial





Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
WikiNewForum)