Execute server side code on close of a browser
To start with create a new asp.net page and add an instance of the ScriptManager to it. Now configure the ScriptManager to enable calling of page methods marked with WebMethod attribute.
The next step is to create a web method on the server.
The method needs to be marked with the WebMethod attribute.