Automatically Calling a Function When a Page Ends

Is there any way to call a function automatically when an ASP page ends? I know about Application_OnEnd and Session_OnEnd but isn’t there any “Page_OnEnd” function or some way of simulating it?

The key here is what you mean by “when an ASP page ends.” If you are talking about server-side processing, just place your code or a call to your function at the very bottom of your page. Assuming that there is no other branching, it will be the last piece of code to be executed before the server ends processing your page.

If you are talking about code to be executed when your site visitor leaves your HTML page, then put a call to your CLIENT SIDE JavaScript, JScript or VBScript code in the ONUNLOAD event of the body tag, such as this:

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: