views:

165

answers:

1

my project had audit module ,which inlcude each and every action of the user to be recoreded

so when the user closes the browser the audit regarding the logout has to be stored in the database

i found one solution in the net ,but it is working in my machine's IE but falied to work in the friends machines IE why? the code is:

window.onbeforeunload = clean_up; 
   function clean_up() 
   { 
    var flex = document.${application} || window.${application}; 
    flex.myFlexFunction(); 
   } 

i place this code in the index.template.html file in the html-template foleder under flex src

and i place the below code in my main application.mxml file

      ExternalInterface.addCallback("myFlexFunction",btnLogout); 

and i defined the logout function

A: 

Ok, here is the deal. CAN NOT BE DONE RELIABLY. If this is for audit... you are out of luck and deliver a half baked approach to start with.

Why?

Go to your task manager, kill the IIS process - nothing logs out. No audit. Ergo - the solution does most likely not fulfill the legal audit requirements ;)

Another approach:

  • Call a service exvery X seconds from the running page. Like every 5 seconds.
  • Assume client dies when you dont receive call for 2 * X seconds (like after 10 seconds).

This way you realize when the client does not connect anymore. Does not stop the user from pulling the network cable and conrinuing viewing, so a failure of the audit method call should wipe the HTML content ;)

But at least you handle browser crashes / terminations, too.

TomTom
thk u,,,,,,,,,,,
kumar1425

related questions