I am introducing the main difference between Application, Session, View State, and Cookies & Query String.
The Application Object: The Application object stores data that is shared across the application and not for a specific user. Whereas every page request gets its own Request and Response objects, all requests for ASP pages in a Web application share the same Application object. This object is created the first time an ASP page is requested from the application after the Web server starts up, and is destroyed when the Web server shuts down, or when the Web application is unloaded manually in the IIS management console. Because this object persists from one page request to another, it can be used to store data that you want to share with all other pages in your application.
Syntax: Application(“varName”) = value
The Session Object: The
Sessionobject is very similar to the
Applicationobject, as it allows you to store values that are shared between all the pages of your site. The main difference between the two is that, where a single
Applicationobject is shared by all pages and all clients that access your site, each client (browser) is assigned its own
Sessionobject. Thus, a
Sessionobject must be created for each user session that occurs on your Website.
(“username”) = “Abhinav bajpai”
The View State: The ViewState allows ASP.NET to repopulate form fields on each postback to the server, making sure that a form is not automatically cleared when the user hits the submit button. All this happens automatically, unless you turn it off, but you can actually use the ViewState for your own purposes as well. Please keep in mind though, that while cookies and sessions can be accessed from all your pages on your website, ViewState values are not carried between pages. StateBag implements the view state and manages the information that ASP.NET pages and embedded controls persist across successive posts of the same page instance.
Syntax: ViewState(“FontSize”) = value
Querystring: Query string is used to pass the values or information form one page to another page.
Thank you ! keep visiting guys....