Conformation before closing the Application

Posted by Anilveera under ASP.NET on 1/25/2012 | Points: 10 | Views : 787 | Status : [Member] | Replies : 1
Hi All,
I had requirement in Asp .net appliction ie... if the user d'nt signoff or logoff then he trys to close the browser ie clicking on 'X' (top right of browser) then i need to show a conformation messasge like "Are you sure you want to close ?" ...
Iam using Masterpage for my application and i tryed the event : "window.onbeforeunload " in my master page its works fine shows an alert(conformation) message. but if i press back button on the browser then also its firing(but it shuold not be) is there any way to full fill my requirement ..plz

Thanks in advance


Posted by: on: 1/26/2012 [Member] Starter | Points: 25

try this

step 1: Add reference ->system.Windows
step 2: add name space using System.Windows.Forms;
and type bellow code in click event
 MessageBox.Show("Are you sure you want to close ?", "Information",MessageBoxButtons.YesNo,MessageBoxIcon.Information);


Anilveera, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response