what is view state and its use
Answer Posted / rashmi thakur
ViewState is a built-in structure for automatically
retaining values among multiple requests for the same page.
The view state is internally maintained as a hidden field
on the page but is hashed, providing greater security than
developer-implemented hidden fields do.
Following are the benefits of using ViewState:-
 No server resources are required because state is
contained in a structure in the page code.
 Simplicity.
 States are retained automatically.
 The values in view state are hashed, compressed,
and encoded, thus representing a higher state of security
than hidden fields.
 ViewState is good for caching data in Web farm
configurations because the data is cached on the client.
Following are limitation of using ViewState:-
 Page loading and posting performance decreases when
large values are stored because
 View state is stored in the page.
 Although view state stores data in a hashed format,
it can still be tampered with because it is stored in a
hidden field on the page. The information in the hidden
field can also be seen if the page output source is viewed
directly, creating a potential security risk.
 If page get destroyed or refresh information which
is stored in view state gets vanished.
Below is sample of storing values in view state.
this.ViewState["EnterTime"] = DateTime.Now.ToString();
| Is This Answer Correct ? | 11 Yes | 7 No |
Post New Answer View All Answers
What are the main requirements for caching?
Is sql backend or frontend?
Explain asp.net application life cycle?
How would you create a permanent cookie?
What are the Types of object in asp
How do I know asp.net mvc version? : Asp.Net MVC
how can create login from create and written conde in asp.net
What are the different kinds of assemblies?
Can we handle the error and redirect to some pages using web.config?
Explain the difference between sql invalidation and sql notification.
How can you register a custom server control to a web page?
What is the procedure to handle the process request using mhpm events fired? : asp.net mvc
How can you identify that the page is post back?
Do you know using sql cache invalidation?
Why should i prefer JSP over asp.net or any other web development language..??