开发者

what is life span for items stored in view state?

Yesterday I went o开发者_StackOverflow中文版n an interview where the panel asked me this question.


Items stored in view state are transmitted to the client's browser as HTML within a hidden control, and sent back to the server when the user posts from that page (details from the indispensable ViewState: All You Wanted to Know):

1) ASP.NET begins rendering the page. All objects in the current ViewState are serialized using a custom format that looks like this: t<1234567890;t<p<l<prpA;prpB;prpC;>;l<valA;valB;valC;>>;

2) That serialized data is encoded and written to an HTML hidden control on the ASP.NET page's form, where it looks like this (simulated data): dDwxMjM0NTY3ODkwO3Q8cDxsPHBycEE7cHJw

3) At this point the items are latent on the client's browser: you might say they're 'hibernating.'

4) If the client posts the page, ASP.NET decodes and deserializes the view state data into objects again, and they 'live' until the request is over (or until they are written to another page).


It exists till your current page exists. ViewState persist the values of controls of particular page in the client when post back operation done. Then user requests another page previous page data no longer available.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜