[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Run ASP Script on Close of Windows Explorer

Posted on 2006-05-02
Medium Priority
Last Modified: 2010-04-17

  I want to Run Server Side Script when use close application by close button of Explorer of ALT + F4.

  just like in VB Application we have event QueryUnload for Form.
Question by:covisible
LVL 32

Expert Comment

ID: 16584618
I don't think there is any event for this so I don't think you can do what you want here.  

Perhaps there is some "trick" to get something similar that someone else knows...

Accepted Solution

lostcarpark earned 500 total points
ID: 16585025
The only way I can see you could do it would be to add a JavaScript handler to the "onUnload" event of the ASP page.

This would need to load your page, but I don't think it could do it in the window that the user is closing, so the only option I can think of is to use a "window.open()" to open your page in a new window. You could set it to open a very small window out of the way.

This would load your ASP page, allowing you to do any cleanup on the server.

I would suggest putting a "window.close()" in the onLoad event of the page to close the window again.

The major problem with this approach is that it's likely to be blocked by a lot pop-up blockers, so unless you have control over your user environment you may have to find another way.

Personally I would advocate designing an application in such a way that your users never need to explicitly log out or close the application, as it's just too hard to predict what will happen on the client side.
LVL 13

Expert Comment

ID: 16586370
I agree 100% with lostcarpark's points ^

You could try using the Session_OnEnd event in global.asa - theoretically, once the browser closes, the session should end soon thereafter.
Not sure how important the timing is in what you want to accomplish...

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Make the most of your online learning experience.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Screencast - Getting to Know the Pipeline

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question