Does ASP.Net call Dispose on the Page/Controls in a page, or must I do this?

前端 未结 4 668
小蘑菇
小蘑菇 2020-12-18 21:01

Given that the Control class implements IDisposable, I would think that ASP.Net is at least capable of triggering a Dispose cascade as the Page finishes it\'s life-cycle on

4条回答
  •  眼角桃花
    2020-12-18 21:36

    This article on The ASP.NET Page Life Cycle states that:

    "Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed."

    I would take that "any cleanup" means disposal of controls etc. I can't imagine that the designers of the ASP.NET framework would have overlooked that and nobody would have noticed.

提交回复
热议问题