Hi here I\'m trying to call a [webmethod] on bodyunload method.
But it is getting fired on page load itself only. How do i prevent it?
Here\'s the code I am
What you are attempting to do is a bad idea. Consider putting less data in the session, or lowering the timeout.
Perhaps you don't realise that onunload fires when the user refreshes or navigates away from the page. So assuming your code actually worked, if you user refreshed their page then their session would be terminated. If they visited any other page on the site their session would also be terminated!
Probably not the functionality you were hoping for!