What is the intended use of an ASP.NET session?

In an ASP.NET application, you can store just about anything in a session as long as you can handle the cost. What is the intended use and what is most alarming about using a session to store data?

+2


a source to share


4 answers


Any user data that needs to be persistent across different application pages for a logged in user can be stored in a session. The objects that need to be persisted in the session must be serialized.



It is generally a good idea to use the session a little sparingly because as the number of concurrent users increases, the load on the server memory increases and at some point it recycles the memory causing all session data to be deleted.This causes a premature session timeout.

+1


a source


I like to use session to store keys or indexes on server data, which doesn't have to be persisted between pages. It is lighter in weight than keeping the entire object (s)



0


a source


In ASP.NET MVC2, TempData is persisted in the session.

Some of them are documented here: ASP.NET MVC - TempData is good or bad practice and here Tempdata improvements .

0


a source


A session is used to store information for each client.

Every time a new client makes a connection, asp.net starts a new session for the newly connected client. You might want to store some information in the current client session and display information about the execution of some operation based on his / her session information.

0


a source







All Articles