title: asp.net best way to clean up unmanaged resources
body: <p>I am a little confused about memory clean up in an ASP.NET application. I had defined several destructors--I know this isn't the new .NET way of doing things, but I am a creature of habit and I always did it this way in c++-- that were working wonderfully in just about every scenario. However, I have noticed that they are sometimes not called in my ASP.NET applications. </p>
  
  <p>I am thinking about implementing IDisposable, but I am under the impression that IDisposable is for other users of your code, and I am not sure that ASP.NET would call Dispose when it is finished with the object. Could someone clarify on this?</p>
  
  <p>What is the best, and by best I mean that it will always work-- way to clean up my unmanaged memory? </p>
  
  <p><strong>Edit</strong></p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/66x5fx1b.aspx" rel="nofollow">This</a> seems to indicate that if the class containing potential unmanaged memory is a member of an encapsulating class, then the destructor is the best strategy. This certainly makes sense to me since I could hardly put a try or a using around a class member. Even then however, that brings me back to my question, it sometimes never gets called in my ASP.NET app.</p>