Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are different types of sessions in ASP.NET

Here I want to know different types of Session in ASP.NET and not Session States. That was the question asked in an interview.

like image 531
nitika tangri Avatar asked Jul 05 '13 09:07

nitika tangri


People also ask

What are types of sessions?

From the perspective of two LUs that are communicating, two types of sessions exist: a contention-winner session and a contention-loser session. Contention occurs when two LUs try to assign the same session simultaneously to different conversation requests received from an application program.

How many types of sessions are there in ASP net2 0?

ASP.NET 2.0 enables two new session ID modes, UseDeviceProfile and AutoDetect, which can use the browser device profile or perform an autodetect of the cookie capability respectively to determine which type of session ID to use on each request.

What are the different types of session management in MVC?

ASP.NET MVC provides three ways (TempData, ViewData and ViewBag) to manage session, apart from that we can use session variable, hidden fields and HTML controls for the same.


2 Answers

Session-State modes are 5 type:

InProc mode: which stores session state in memory on the Web server. This is the default.

StateServer mode: which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

SQLServer mode stores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

Custom mode: which enables you to specify a custom storage provider.

Off mode: which disables session state.

Check the detail. https://msdn.microsoft.com/en-us/library/ms178586.aspx

like image 105
Bilal Ibrahim Avatar answered Oct 14 '22 07:10

Bilal Ibrahim


Typical sessions are based on a cookie. The server gives you one, you send it to the server upon every request. However, Asp.net allows you a different type of sessions as well - cookieless sessions. The session id is then "stored" in the URL address. This technique is very dangerous if used improperly.

like image 29
naivists Avatar answered Oct 14 '22 07:10

naivists