View State Vs. Session State Vs. Application State

View State
View State is a technique to maintain the state of controls during page post-back, meaning it stores the page value at the time of post-back (sending and receiving information from the server) of your page and the view state data can be used when the page is posted back to the server and a new instance of the page is created.
View state data is nothing but a serialized base-64 encoded string stored in a hidden input field on the page and it travels between the browser and the server on every user request and response.

View State advantages:
Very easy to implement.
Stored on the client browser in a hidden field as a form of Base64 Encoding String not encrypted and can be decoded easily.
Good with HTTP data transfer
View State disadvantages:
The performance overhead for the page is larger data stored in the view state.
Stored as encoded and not very safe to use with sensitive information.

Where to Use : View state should be used when the user needs to store a small amount of data at the client browser with faster retrieval. The developer should not use this technique to retain state with larger data since it will create a performance overhead for the webpage. It should be used for sending data from one page to another.

ASP.NET Session State
Session State is another state management technique to store state, meaning it helps in storing and using values from previous requests. Whenever the user requests a web form from a web application it will get treated as a new request. an ASP.NET session will be used to store the previous requests for a specified time period.
By default, an ASP.NET session state is enabled for all ASP.NET applications. Session state data is shared across all the web pages.
Session variables are single-user global data stored on the web server, meaning by default a session state variable is stored in the web server memory and is available across all pages but it will be for a single session.

Application State
Application state is stored in memory on the server and is faster than storing and retrieving information in a database. Unlike session state, which is specific to a single user session, application state applies to all users and sessions.
Application state variables are also used to store data when navigating from one page to another. It's multi-user Global data meaning it will be accessible across all pages and all sessions.
An application state variable does not have any default time unlike session variables. It will end when the application hosting process is restarted or the application ends.



What is the difference between SessionState and ViewState?

Session state is saved on the server, ViewState is saved in the page.
Session state is usually cleared after a period of inactivity from the user (no request happened containing the session id in the request cookies).
The view state is posted on subsequent post back in a hidden field.

SessionState
Can be persisted in memory, which makes it a fast solution. Which means state cannot be shared in the Web Farm/Web Garden.
Can be persisted in a Database, useful for Web Farms / Web Gardens.
Is Cleared when the session dies - usually after 20min of inactivity.

ViewState
Is sent back and forth between the server and client, taking up bandwidth.
Has no expiration date.

Is useful in a Web Farm / Web Garden