Saving Viewstate on Server

帅比萌擦擦* 提交于 2020-01-03 05:42:05

问题


What is the best way to save view state on server?

Is it a good idea to use a WCF service to save the view state on the server?


回答1:


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 and LoadPageStateFromPersistenceMedium on your Page.

  • You can override PageStatePersister property of your Page (or in custom PageAdapter). This property by default returns HiddenFieldPageStatePersister but you can change it to SessionPageStatePersister or implement custom PageStatePersister. Here you can read about PageStatePersisters.




回答2:


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.


来源:https://stackoverflow.com/questions/4645696/saving-viewstate-on-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!