Skip to main content

Microsoft Silverlight

Proper utilization of Application_ExitRSS Feed

(0)

jpsscott
jpsscott

Member

Member

51 points

84 Posts

Proper utilization of Application_Exit

Hi,

 I have a database back-end in a Silverlight app.  When the app exists I want to call to the server to update my "last record" the user is editing.  So far I've noticed two problems here:

1)  Application_Exit event seems to be firing twice

2)  Doing an async call using HttpWebRequest doesn't work because the sockets/UI thread/whatever gets closed down before my call to the server completes.

 So I guess the big question is how can I save information to our back-end database from the application_exit event?  I also noticed that the documentation says "this shouldn't contain long-running code".  What's considered long running code?  Obviously we wouldn't want something looping endlessly or taking an extreme amount of time, but I do have data and settings I need to save back to server.

I want to be able to save that information in all cases (user closes browser, user refreshes view etc.)

Thanks for any insight!

James

tonypujals
tonypujals

Member

Member

10 points

5 Posts

Re: Proper utilization of Application_Exit

I'm interested the answer to this as well. I'm trying to have my wcf proxy unsubscribe from a notification service right before closing it, but raises an exception from System.ServiceModel if I attempt to do it from Application_Exit.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities