If I remember right I used to deal with this in some old Silverlight development, as I had 3 seconds to do whatever I needed on a user initiated exit. This made any web service type calls such as logging, analytics, or a session close event very problematic. Our solution was to do any local work we ...