Saving Viewstate on Server
What is the best way to save view state on server?
Is it a good idea to u开发者_运维问答se a WCF service to save the view state on the server?
Are we talking about ASP.NET view state? Why do you need WCF to store view state on the server? ASP.NET provides its own methods to store view state on the server:
You can override
SavePageStateToPersistenceMedium
andLoadPageStateFromPersistenceMedium
on yourPage
.You can override
PageStatePersister
property of yourPage
(or in customPageAdapter
). This property by default returnsHiddenFieldPageStatePersister
but you can change it toSessionPageStatePersister
or implement customPageStatePersister
. Here you can read about PageStatePersisters.
There's a project on CodeProject that you should look at called Efficient Server-Side View State Persistence. This meets the following criteria:
- The View State needs to be persisted on the server.
- The View State persistence mechanism needs to be identified by a specific user session.
- The persisted View State artifact must not be allowed to remain forever.
- The persisted View State should be able to be enabled and disabled on a page by page bases.
- Different persistence mechanisms should be able to be used.
- Page development and structure should not be modified.
精彩评论