Saving contents of ApplicationState in ASP.Net (MVC)
Posted
by Saqib
on Stack Overflow
See other posts from Stack Overflow
or by Saqib
Published on 2009-10-20T16:20:19Z
Indexed on
2010/06/10
22:02 UTC
Read the original article
Hit count: 270
I have an internal app used to edit XML files on disk. The XML files are loaded into an object model which is stored in ApplicationState.
I need to save this data. The one option is to do this every time the user changes some data. However, this seems a bit inefficient - writing the data out to disk each time a change is made.
Instead, is it possible to be notified whenever the user closes their browser, plus just before the web server exits? Thus, the data would be saved each time a session ends, plus when the computer shuts down, etc. I thought that Application_End(), Application_Error() and Session_End() in Global.asax would provide this, but these methods don't seem to be called.
© Stack Overflow or respective owner