What are the limitations of the view state approach?
I know that the view state approach is limited to only a specific page. When we navigate to another page then information is lost. Other tha开发者_如何学Gon this limitation are there any limitations with view state?
I don't know if these are exactly "limitations", but they are certainly reasons you should avoid viewstate for certain things.
- All data in ViewState is uploaded and downloaded with every page request.
- Data in ViewState is not secure since it is available client side.
- All items in viewstate must be serializable.
- You cannot store server side resource in ViewState (think database connection, etc.) because each request the items are generated fresh (THEY ARE NOT THE SAME OBJECTS)
What are you trying to use ViewState for?
The only real limitation is that view state explodes the page size (up to many megabytes if not paid attention to). The more stuff you put into view state, the more convenient you do it for yourself, the less convenient it becomes for the users, especially those with dial-up connection.
There may be some networking issues if network components are configured to restrict submission size. I've heard something about proxy servers imposing limits on hidden fields (where the view state is stored).
精彩评论