Browser close event (MSIE and FF): how to detect browser close ?


P

pamelafluente

Hi Guys

this time I have a question which involves both Javascript and perhaps
ASP.NET.

Ok. I am working on a sort of reporting systems which works like this:

There is an IIS ASP.NET server. On the server there is a binary file
(call it "Source Report") which
stores all informations to create an HTML page (call it "Web Report").

There is a JAVASCRIPT file on the server (which is referred to inside
the Web Report) which
is responsible to send, via get, some commands (for instance a "drill
down") from the Web report to
an file .aspx (call it "Report Processor"), which sends the command to
the server which, in case, regenerates the Web Report by a direct write
to disk and redirect the user's browser to the new version..

To allow concurrency, everytime a user make a request of a report, I do
this: I create a new temporary folder
(the name of the folder id a basically reportID+Timestamp). In the
temporary folder I copy the Source Report and then everything the user
does on the report (regeneration, drill, change the report by sending
parameters, etc) happens within that folder.

This way the user can work on multiple different instances of the same
Source Report, and can have completely different views (Web Reports) of
the same Source report. For each report instance which is created I
store all relevant information (including an identificator and temp
folder name) in a session variable, so it can be retrieved any time.
Each Web Reports stores inside the instance identificator.

--> Now my question. When the user closes the browser and goes away I
would like to be able to do some cleanup programmatically. For
instance, I would like to remove the temporary folders created to deal
with report instances.

Could you advise for the best method to detect when the user closes the
browser and send this information to the server through my aspx file
(Report Processor) ? In other words, can you see a function I can place
in my JS file which would transmit (via GET) the event to the aspx and
therefore to the server?

Hope I have been clear with my poor English. Please just ask if not ...

Thank you

PAm
 
Ad

Advertisements


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

Top