When are ASP.NET MVC Controllers garbage collected?

Welcome to Programming Tutorial official website. Today - we are going to cover how to solve / find the solution of this error When are ASP.NET MVC Controllers garbage collected? on this date .

Once a controller object is created when does it become available for garbage collection?

Answer

Usually when no active reference to this object is detected. This is handled internally by the garbage collector and so you do not have to take care about it.

So, having this in mind, after the moment Page_Unload method is called which is hosting the controller, the garbage collector gets notified that the controller object is ready for disposal.