How can I close the current aspx web form?
Posted on 2006-04-26
I've an asp.net web app in C#, and I want to have a button which will close the form, thus exiting the application. Equivalent to the user clicking the X button.
In the button click event I've tried: btn_CloseForm.Attributes.Add("onclick","window.close('FormName.aspx');");
...however, nothing happens the first time this is clicked, and the second time its clicked a messagebox appears asking for confirmation that the user wants to close the form. I need the form to close immediately on clicking the 'closeForm' button.