Tuesday, 4 February 2014

Session in Dot Net


Q:How Many types of session modes available in asp.net?

  • In-Process – It stores the session in local system.
  • State Server – It stores the session in a process called “ASP.NET state service”.
  • SQLServer – It stores the session in SQL Server database.
  • Custom – It allows the custom storage provider.
Q:What is the default session modes in asp.net?
Ans: InProcess

Q:What are the disadvantages of using InProc session mode?
Ans: Its stores session information in the current Application Domain.
So it will lose data if we restart the server.

Q:Session_End() event is supported by which session mode only?
Ans: Session_End() event is supported by InProc mode only.

Q:What do you understand by StateServer(Out-Proc) mode?
Ans: StateServer session mode is also called Out-Proc session mode. StateServer uses a stand-alone Windows Service which is independent of IIS and can also be run on a separate server. This session state is totally managed by aspnet_state.exe. This server may run on the same system, but it's outside of the main application domain where yourweb application is running. This means if you restart your ASP.NET process, your session data will still be alive.

Q:Under StateServer(Out-Proc) mode the session state is managed by?
Ans: aspnet_state.exe

Q:What are the advantages and disadvantages of StateServer(Out-Proc) Session mode?
Ans: Advantages:
It keeps data separate from IIS so any issues with IIS will not hamper session data.
It is useful in web farm and web garden scenarios.
Process is slow due to serialization and de-serialization.
State Server always needs to be up and running.

Q:Under SQLServer Session Mode where the session data store?
Ans: In SQLServersession mode, session data is serialized and stored in A SQL Server database.

Q:What is the big disadvantage of SqlServer Session mode?
Ans: The main disadvantage of SqlServer Session mode storage method is the overhead related with data serialization and de-serialization.

Q:What are the advantages and disadvantages of SqlServer Session mode?
Ans: Advantages:
Session data not affected if we restart IIS.
The most reliable and secure session management.
It keeps data located centrally, is easily accessible from other applications.
Very useful in web farms and web garden scenarios.
Processing is very slow in nature.
Object serialization and de-serialization creates overhead for the application.
As the session data is handled in a different server, we have to take care of SQL Server. It should be always up and running.


No comments:

Post a Comment

C# program Selection Sorting

Selection sort is a straightforward sorting algorithm. This algorithm search for the smallest number in the elements array and then swap i...