Friday, January 31, 2014

Application Object

Application object is used to store the information and access variables from any page in application. Application object is same as session object only the difference is session object is used to maintain the session for particular user while application object store the information for application same for all users i.e. If one user enters into the application then session id will create for that particular user if he leaves from the application then the session id will deleted. If they again enter into the application they will get different session id but application object is same for all users once application object is created that application object is used throughout the application regardless of user. The information stored in application object accessed throughout all the pages in application (like database connection information) and we can change the application object in one place those changes automatically reflected in all the pages.
You can create application objects in Global.asax file and access those variables throughout the application.
Application object remain in memory until the web server shut down or the web.config site configuration has changed.

No comments: