Hi,
It is my understanding that for a VB6 COM object when it goes out of scope Class_Terminate is immediately called on the object to allow it to clean up.
Is it possible to have that same functionality for a .NET object that is being called by COM?
The background to the question is based on the MSDN article: http://msdn.microsoft.com/en-us/library/aa479313.aspx
This replaces the Session object in an ASP page with a custom object that serializes the Session information back to a database as soon as the page finishes by utilising Class_Terminate.
I want to implement the object in .NET, however as the GC won't call the finalizer immediately it is a bit of a problem, as I don't want to have to wait for the object to be cleaned up before being serialized back into the database.
I could just implement IDisposiable and manually call Dispose() when finished with the Session, but that would require altering every existing ASP classic page rather than just being able to include a few lines in a standard include file.
So is there a way to automatically call the code to do the work that is required when the page has finished? :)