Silverlight Web Request on Application Exit

August 17, 2009

I was just looking into persisting the state of a Silverlight application on exit. The scenario is that the application has a complex layout that we normally persist to a database via a RESTful service call. The problem is what if the user forgets to explicitly save the layout before shutting the browser down. So I looked into calling the service in the Application_Exit method in the App class. Sadly this does not work – it appears that the request is queued on the Dispatcher thread after the shutdown process and so never executes. Guess I’ll have to save the state to isolated storage and put some hacky code in to determine if there is a saved state in ISO before loading the layout from the DB. Bit of a bummer if the user uses more than one machine though…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: