Because of the way the web works, you will never know when a user closes the
browser. The only time that the web server and the browser are connected are
while the browser is fetching the page, they're disconnected once the page
finished loading. After that, they don't talk until the user performs some
action. Your best time to clean up the objects is right after you are
finished with them. You don't have to necessarily clean up all the controls
on a page, but, for example, you would need to make sure that a SqlReader
that is bound to a DataGrid is closed after the DataGrid's DataBind() method
is called and also that the SqlReader is then set to null to help the
garbage collection pick it up. It doesn't matter if this is done in VB.Net
or C#, they both have similar mechanics. The difference you're going to run
into is moving from a Windows Forms environment to an ASP.Net Web Forms
environment, and they often have very different behavior.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"Asha" <As**@discussions.microsoft.com> wrote in message
news:53**********************************@microsof t.com...
hello,
i wants objects to be clean up after a page close, either by a button or
by
clickingon the x on the top right of the browser.
so in vb.net i would use the finalize method... but how can this be done
in
c#? i want a finalize a methond. thanks