I want to cature an event that will run only when the web form is closed(ie. the window.close() method is used or the 'X' is pressed). I thought this would be the page unload event, but this runs on every postback same as page load. Ideally, what i need is the opposite of the "override protected void OnInit(EventArgs e)" method as this only runs once when the page is opened. I need to capture this in the code-behind as i need to do several db updates. Whats the best way to do this ?
Note: C# is the code behind i am using.