Saving data on close of browser window

M

M B HONG 20

Hi all -

I am developing an ASP.NET (C#) web application. I need a form to save
all information upon a user clicking the "X" close button (top right
corner). After some research I have come to the conclusion that a C#
function cannot be called from the client javascript. I have also come
to the conclusion that a C# function cannot be tied to the event of a
client closing a window with the "X". My options are either to catch
this as an event in the code-behind, or just disabling the "X"
altogether. Any help on this would be greatly appreciated, thanks in
advance.
 
Y

Yunus Emre ALPÖZEN [MCSD.NET]

U cannot do this due to security restrictions. You can handle
window.onunload event at client side and open a popup window and call aspx
page which u want to handle page close.. But this is a pseudo remedy, not a
solution. Because, pop blockers and SP2 will block your popup.. Web
Applications are connectionless this is why u can not do it.

--
HTH

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top