aspx:
html xmlns="http://www.w3.org/1999/xhtml">
function TestAJAX11() {
//alert('This is Testing of Close event');
PageMethods.TestAJAX();
}
window.onbeforeunload = function () { TestAJAX11("hello", "hai"); }
Detect Browser Exit