Well... one idea would be to force login before you start generating a form state that you need to persist. Otherwise, you'll need to save all the form state data separately (session, or other persistant-across-pages method).
I don't know if it's possible to take the viewstate object for a page, drop it in the session, then manually restore it when you return to the page. I don't see a reason that wouldn't work, it's just a bit of tricky coding. Seeing as you can override the page's LoadPageStateFromPersistenceMedium method or the other viewstate related methods, there is probably some way of doing it manually. When some event happens that causes the page to redirect to the login page, you save the viewstate object into the session. Then when you return to the page (that is, the page load's without a postback) the page can check the session to see if there is a viewstate object for it and load it up. I have worked with the viewstate persistance methods with some success when writing custom server controls so I know it's doable. Just not sure about saving the WHOLE viewstate. (If you do manage to figure it out, I'd recommend that you make sure you remove the viewstate object from session when you retrieve so as not to confuse a hit to the page when you aren't really returning.)
Peter
|