Wednesday, 6 July 2016

ViewState



1). what is View State in Asp.net?


View state is nothing but a method that the ASP.NET use to preserve page and control values between postbacks. 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. This information is then put into the view state hidden field.

2). View state is client-side or server side state management technique?



View state is client-side state management technique

3). What are the client-side state management technique supported by ASP.NET?


1.      View state


2.      Control state


3.      Hidden fields


4.      Cookies


5.      Query strings



4). View state is used by Asp.net page aromatically or we need to apply it manually?



 View state is used automatically by the ASP.NET page framework to persist information that must be preserved between postbacks.


5). When you can use(take advantage of vs) view state?  or What you can do by use view state?


1.      Keep values between postbacks without storing them in session state or in a user profile.


2.      Store the values of page or control properties that you define.


3.      Create a custom view state provider that lets you store view state information in a SQL Server database or in another data store.



6). What are the advantages of using view state?


No server resources are required : The view state is contained in a structure within the page code.
Simple implementation : View state does not require any custom programming to use. It is on by default to maintain state data on controls.
Enhanced security features : The values in view state are hashed, compressed, and encoded for Unicode implementations, which provides more security than using hidden fields.

7). What are the limitations of view state?


 Limitations: Because view state is stored in the page, it results in a larger total page size. ASP.NET uses view state only with page and control properties. View state isn't a good place to store sensitive information that the client shouldn't be allowed to see. click on the below link to keep continue for same type of questions with answers.


8. What is the concept of view state in ASP.NET?


As in earlier question, we understood the concept of postback. So, in order to maintain the state between postbacks, ASP.NET provides a mechanism called view state. Hidden form fields are used to store the state of objects on client side and returned back to server in subsequent request (as postback occurs).


If we see the view source for an ASP.NET web page, we will find that hidden form field with Id = “__VIEWSTATE” something like the following:View State in ASP.NET


 


9. In which event of page cycle is the ViewState available?



   After the Init() and before the Page_Load().


 


10.Where the viewstate is stored after the page postback?


ViewState is stored in a hidden field on the page at client side.  ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.


 


11 How long the items in ViewState exists?


 


They exist for the life of the current page.

No comments:

Post a Comment