I observed that there is savepagestatetopersistencemedium method, and we can override and implement them to save them to cache or session or whatever, so what is a page state? And I have no idea what the outputcache directive to trying to save, the viewstate or the html rendering? what is a viewstate exactly?
2 Answers
You have two topics listed: one, which is the state of a page, and output caching, which is the caching of the page response. For output caching, the page lifecycle does not fire for subsequent requests of the cached page (until the cache is removed) as a way to save on performance. Persistence is the persistence of the data on the page between requests. ViewState is a mechanism to not lose a form's data across postbacks (since the web is stateless). You can use the savepagestatetopersistencemedium method to customize how the saving and loading can work, like by compressing viewstate.

- 50,520
- 35
- 148
- 257
Page state refers to the ViewState
, which is a hidden field on the page (default) used to persist the state of controls on a page. The PageStatePersister
allows you to change the location or medium where ViewState data is stored.
The article below provides an example demonstrating how you can use PageStatePersister
to store ViewState data in session rather than a hidden field:

- 45,496
- 8
- 73
- 110