Access Viewstate across pages in ASP.NET « Ramani Sandeep's Blog

added by sandy060583
1/9/2010 5:49:16 AM

0 Kicks, 59 Views

There was one question during my recent work in one of my ASP.NET Project. “Is it possible to access the ViewState variable of one page on another page?” My answer was “No” . Because i have read in books that Viewstate is page specific, it is available only on the same page on which it was created.Once you redirect to another page, the previous page’s viewstate is no longer accessible. But that is not true. Yes, we can access the viewstate variables across pages. This is only possible if Cross Page Posting or Server.transfer is used to redirect the user to other page. If Response.redirect is used, then ViewState cannot be accessed across pages.


1 comments

bijayani
1/25/2010 12:13:15 AM
Hi,

I happened to see your post and find it very informative.
I would like to give a small description on Viewstate which is as follows.

"View state maintains data in a page across postbacks. And this data passes in form of hidden field data. There is a certain limitation of this hidden field. If your hidden field will be greater than that specified value, then sometimes firewalls and proxy servers refuse to let your data passes through. And in that case you have to disable your view state .This might cause many problem if you want your data to be passed."

Here is the link for more detail information on Viewstate:
www.mindfiresolutions.com/a-tip-while-using-viewstate-548.php

Hope you find it quite impressive.

Thanks,
Bijayani