What pitfalls arise by using a custom view-state p

2019-07-17 17:06发布

I have recently started researching how to use a custom view-state provider to move storage of viewstate from the page to the server. The obvious advantage of this is reducing the rendered page size and thus, increasing the user experience. Also, the biggest disadvantage that I know of is that server memory usage will increase. For this issue I can easily move the storage to a different server than the web server (AppFabric, for example) Besides this, are there other pitfalls that may arise? Are there situations where one would use the normal view state provider and not a custom view state provider?

I hope my question is clear.

Thanks!

2条回答
Emotional °昔
2楼-- · 2019-07-17 17:10

If the thread/process that holds that data crashes you'll lose it (given you're going to store it in memory). Same thing with inproc/aspstateserver session. Sometimes it just crashes = goodbye, data. But it's impossible when your viewstate is stored on page = more reliability.

查看更多
Root(大扎)
3楼-- · 2019-07-17 17:19

Recently I did this in my application and have not had any issue doing so.

But before moving to maintain a custom Viewstate, you have to think of User traffic. If traffic is high then I would not recommend maintaining Viewstate on the server. In that case you have to consider other ways to improve the performance of your application.

Have a look on this very good article an Analysis of Keeping ViewState out of the Page

查看更多
登录 后发表回答