asp.net periodically send messages to server
I'm using VS2010,C# for developing ASP.NET. I want to send periodical messages to server in order that server knows which user is really active (with open windows), so that when a user closes window or changes url (instead of clicking on logout button), my server can detect user sign out and can close his session. what are my options here? I don't think JavaScript would be safe as I should probably update my database (is there any other way? for instance can I call an address in my JS function?)

Another solution would be to use AJAX to send server side messages to server, is it safe and efficient? what is the best way? security is really important for me

asp.net periodically send messages to server
===

I'm using VS2010,C# for developing ASP.NET. I want to send periodical messages to server in order that server knows which user is really active (with open windows), so that when a user closes window or changes url (instead of clicking on logout button), my server can detect user sign out and can close his session. what are my options here? I don't think JavaScript would be safe as I should probably update my database (is there any other way? for instance can I call an address in my JS function?)

Another solution would be to use AJAX to send server side messages to server, is it safe and efficient? what is the best way? security is really important for me
