There are many ways to accomplish this.
Other ways are as follows:
in .aspx.cs write following code:
Page.ClientScript.RegisterStartupScript(this.GetType(), “alert”, “Disconnect();”, true);
in .aspx write following code:
Other way is:
Refer another good article at :