Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 38079 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > .NET Framework Interview Questions > What are session management techniques i ...

What are session management techniques in .NET?

Interview question and answer by: SheoNarayan | Posted on: 4/9/2008 | Category: .NET Framework Interview questions | Views: 13307 |
Ads
Ads


Answer:

There are three different techniques of managing session in ASP.NET
InProc
Session state is stored locally in memory of ASP.NET worker process.

StateServer
Session state is stored outside ASP.NET worker process and is managed by Windows service. Location of this service is specified by stateConnectionString attribute.

SQLServer
Session state is stored outside ASP.NET worker process in SQL Server database. Location of this database is represented by sqlConnectionString attribute.

For more details, please visit
http://shailkpatel.blogspot.com/2007/03/session-management-techniques.html895r

Asked In: Many interviews | Alert Moderator 
Found interesting? Add this to:


 Responses

Posted by: Biswarup90 | Posted on: 23 Nov 2011 01:27:23 AM | Points: 10 | Alert Moderator 

Session Management can be achieved in two ways

InProc

Adv.:
1) Faster as session resides in the same process as the application
2) No need to serialize the data

DisAdv.:
1) Will degrade the performance of the application if large chunk of data is stored
2) On restart of IIS all the Session info will be lost


State Server
Adv.:
1) Faster then SQL Server session management
2) Safer then InProc. As IIS restart
won't effect the session data

DisAdv.:
1) Data need to be serialized
2) On restart of ASP.NET State Service session info will be lost
3)Slower as compared to InProc

SQL Server
Adv.:
1) Reliable and Durable
2) IIS and ASP.NET State Service
restart won't effect the session data
3) Good place for storing large chunk of data

DisAdv.:
1) Data need to be serialized
2) Slower as compare to InProc and State Server
3)Need to purchase Licensed
version of SQL Server




Posted by: Biswarup90 | Posted on: 23 Nov 2011 01:34:29 AM | Points: 10 | Alert Moderator 

Example of InProc:
<sessionState mode="InProc" cookieless="false" timeout="10" />

Mode attribute is set to InProc (the default) to indicate that the session state is stored in memory by ASP.NET and that cookies will not be used to pass the session ID. Instead, the session ID is inserted into the query string for a pages URL.
For example:
Using InProc mode, after a session is established, a call to a hypothetical ASP.NET page would look something like the following
http://my.websitename.com/(mfghvgblurtywsityvjq)/dotnetfunda.aspx

Pros and cons of the three session management solutions in brief

InProc - stored in memory on web server

This is the default setting.
Pros: least overhead, fastest performance
Cons: breaks web clusters, restarting IIS loses sessions
StateServer - managed by a remote service (aspnet_state)

HTTP protocol over TCP port.
Pros: reasonably fast, works with clusters
Cons: clear text, no authentication, overflows...
SQLServer - stored in SQL Server DB tables

Uses normal ODBC connection.
Pros: reliable, scalable
Cons: relatively slow, much overhead



Posted by: Nareyugam | Posted on: 23 Apr 2012 06:28:34 AM | Points: 10 | Alert Moderator 

Three types:
1. InProc: Stores locally in Asp.netWorker process
2. SessionState:Stores Outside the worker process through windows services
3. Sqlserver: Stores through Sqlserver Database




Posted by: Vivekjj | Posted on: 05 Oct 2012 02:48:54 AM | Points: 10 | Alert Moderator 

1)InProc
2)OutProc

OutProc is two types
1)State Server
2)SQL Server

>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from SheoNarayan

    Even more ... | Submit Interview Questions and win prizes!


    About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
    General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
    Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 8:12:14 AM