by Moridin8
20. January 2008 20:07
Yes it's been a while since I have been around. Moving to the USA and all that... you know?
Anyway, I am getting a little tired of people mis-aligning the old ViewState in session thing - mostly due to bad implementations or 'attempts'. So here is how it should be done:
Create a browser file:
<browsers>
<browser refID="Default">
<controlAdapters>
<adapter controlType="System.Web.UI.Page"
adapterType="YourNM.PageStateAdapter" />
</controlAdapters>
<capabilities>
<capability name="RequiresControlStateInSession"
value="true" />
</capabilities>
</browser>
</browsers>
Then you create the class thus:
public class PageStateAdapter : PageAdapter
{
public override PageStatePersister GetStatePersister()
{
return new SessionPageStatePersister(this.Page);
}
}
And voila... No need to worry about which page uses which session cached viewstate as it is all handled by the SessionPageStatePersister.
No worries...