This post originated from an RSS feed registered with .NET Buzz
by Daniel Zeiß.
Original Post: ASP.NET ViewState in a Session
Feed Title: Daniel's Blog
Feed URL: /error.aspx?aspxerrorpath=/danielz/Rss.aspx
Feed Description: ComfortASP.NET - AJAX for all
some words about the new feature for ComfortASP.NET 0.4 that saves the ASP.NET ViewState into a server session. You might wonder why this feature is only available for ASP.NET 1.1 and not for ASP.NET 2.0. The answer is easy: ASP.NET 2.0 already supports Session ViewState, but it is switched off by default. The class that's required is called SessionPageStatePersister. Please read this Article from Microsoft to see how to use it.
Another issue with the ViewState in a Session is the simple fact, that a Server Session will (and should) time out somewhen. In this case all of the ViewState is lost. So you should write some detection code that triggers the right action for this szenario (e.g. redirecting to some kind of start page). This Article shows some good ideas how to detect a session timeout.
Last but not least I have to inform you about a little bug in ComfortASP.NET V0.4 that throws an exception when the session timed out. Please turn off the feature "PersistViewStateInSession" until the next version will fix this. Thank you for your patience!