Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am assigning the value to a static field at page load, which can be used in various operation of the page. But finally when page is being closed, I have to assign null value to the same static field.

Can anybody help to raise an event when the page is being closed so that to assign null value to static field. Or any alternate way to do this? Appreciate your help.....


Thanks
Posted
Updated 3-Jan-13 16:53pm
v2

1 solution

There is no way to do this. You can add an AJAX call to your page when the page is closed, but you can't be certain it will be called, making it close to useless. I assume you know there's no page lifecycle when the browser is closed, and so no server side code runs at all.

your design sounds a bit odd, I'd suggest your better place to store things is the session, so only the current user can see it and it doesn't matter when they close the browser
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900