How to call Asp.Net Button click event when Browser Close or(ALT+F4)
<p>I need to call Asp.net button click event  When  browser is manually closed or(ALt+F4).
I have tried the below,</p>

<p>First of all, create a new ASP.NET page in your favorite IDE and add an instance of the ScriptManager to it. Make sure you configure the ScriptManager to enable Page Methods.
Listing 1</p>

<pre><code>&lt;asp:scriptmanager id="ScriptManager1" runat="server" enablepagemethods="true" /&gt;
</code></pre>

<p>Next, we will subscribe to the unload event of the body tag of the ASP.NET page and assign a callback method to be called when this event fires.
Listing 2</p>

<pre><code>&lt;body onunload="HandleClose()"&gt;
</code></pre>

<p>The HandleClose function is placed within the Head section of the page.
Listing 3</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
 function HandleClose() {
 alert("calling button click event");
  PageMethods.call();} &lt;/script&gt;
</code></pre>

<p>in aspx.cs Page:</p>

<p><code>[WebMethod]</code> </p>

<pre><code>public static void call()
{


  --Btn_click(object sender,e);


  Tried to call button event; }
</code></pre>

<p>But obviously I cant achive it in static method....Is it any other way to achive my scenario....</p>
