Interview Question
Qus: What is the difference between session object and application object?
1) Session variables are used to store user specific information where as in application variables we can't store user specific information.
2) Default lifetime of the session variable is 20 mins and based on the requirement we can change it whereas application variables are accessible till the application ends.
3) Sessions allows information to be stored in one page and accessed in another, and it supports any type of object, including your own custom data types whereas application state allows you to store global objects that can be accessed by any client.
Answers (2)
o For example: If a user enters into the application then he will get a session id. If he leaves from the application then the session id is deleted. If he again enters into the application, he will get a different session id.
o But in the case of application object the id is maintained for whole application.
2) Default lifetime of the session variable is 20 mins and based on the requirement we can change it whereas application variables are accessible till the application ends.
3) Sessions allows information to be stored in one page and accessed in another, and it supports any type of object, including your own custom data types whereas application state allows you to store global objects that can be accessed by any client.