TSessionPageStatePersister class
TSessionPageStatePersister implements a page state persistent method based on sessions. Page state are stored in user sessions and therefore, this persister requires session to be started and available.
TSessionPageStatePersister keeps limited number of history states in session, mainly to preserve the precious server storage. The number is specified by HistorySize, which defaults to 10.
There are a couple of ways to use TSessionPageStatePersister. One can override the page's TPage::getStatePersister() method and create a TSessionPageStatePersister instance there. Or one can configure the pages to use TSessionPageStatePersister in page configurations as follows,
- <pages StatePersisterClass="System.Web.UI.TSessionPageStatePersister" />
The above configuration will affect the pages under the directory containing this configuration and all its subdirectories. To configure individual pages to use TSessionPageStatePersister, use
- <pages>
- <page id="PageID" StatePersisterClass="System.Web.UI.TSessionPageStatePersister" />
- </pages>
| Method Details |
getHistorySize
| public integer getHistorySize |
() |
| Output |
|
integer
| maximum number of page states that should be kept in session. Defaults to 10. |
| Exception |
|
getPage
| public void getPage |
(TPage 0 ) |
| Input |
| TPage | 0 | the page that this persister works for |
| Output |
| Exception |
|
load
Loads page state from session.
| Output |
|
mixed
| the restored state |
| Exception |
| throws | THttpException if page state is corrupted |
|
save
| public void save |
(mixed $state ) |
Saves state in session.
| Input |
| mixed | $state | state to be stored |
| Output |
| Exception |
|
setHistorySize
| public void setHistorySize |
(integer $value ) |
| Input |
| integer | $value | maximum number of page states that should be kept in session |
| Output |
| Exception |
| throws | TInvalidDataValueException if the number is smaller than 1. |
|
setPage
| public void setPage |
(TPage $page ) |
| Input |
| TPage | $page | the page that this persister works for. |
| Output |
| Exception |
|