I’m trying to get asp.net to store viewstate in the session rather than bulking up the html.
Now i’ve read that asp.net comes with the SessionPageStatePersister which can be used instead of the default HiddenFieldPageStatePersister to do this. I was wondering how i go about dropping it in?
This is what i’ve got so far:
I think i need to create a PageAdapter that returns a SessionPageStatePersister from its GetStatePersister method, and somehow get the page to use this pageadapter. But Page.PageAdapter only has a getter, so i’m not sure how you set it.
See the ‘remarks’ heading here: http://msdn.microsoft.com/en-us/library/system.web.ui.hiddenfieldpagestatepersister.aspx
Thanks!
In order to use your custom PageAdapter class you have to register it with .browser file. You need to add (if you don’t already have) a App_Browsers directory. Then add a .browser file with following XML
replace {Your adapter type} with your adapter type.
More information here
Hope this helps.