Here I want to know different types of Session in ASP.NET and not Session States. That was the question asked in an interview.
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.
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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With