Posts

Showing posts from December, 2018

ViewState vs Session vs Cache

HTTP is a stateless protocol. This implies that every time a new request is sent from the client to the server the state information of the previous request is lost When it comes to persisting data across PostBack(round trip to application server) which is basis of web application, there are various options available and they all have there own pro/con. Lets have a detailed look at each of them. 1)ViewState:- ViewState is the method that web application uses to preserve page and control values between round trips. When the HTML markup for the page is rendered, the current state of the page and values that must be retained during PostBack are serialized into base64-encoded strings. Since ViewState is serialised and stored on the page back to client, payload increases as ViewState increases , which means if you have more data in ViewState size of page will be more and it will take more time to reach and load on client side.Hence size of page is directly proportional to ViewState