Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Logging user in and out
Message
General information
Forum:
ASP.NET
Category:
MVC
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01597445
Message ID:
01597491
Views:
39
>It's MVC Viv so what's the equivalent ?

Are you using the default _Layout.cshtml page ? If so then I was just thinking of just adding the script in the usual ' before end body' position:
<script type="text/javascript">
        window.onunload = function() {
            //Code to notify server here
        };
    </script>
But I tried this and it doesn't work very well. It fires if you close the browser when on a relevant page - which is fine. But it also fires when using the prev/next arrows (which you wouldn't necessarily want since it might just be going to another page on your server) and it *doesn't* fire if you just type in and navigate to another url (which you maybe would want). So I guess your stuck with waiting for the session to expire as an indicator that the user is no longer around. Of course if you shorten the timeout to improve the accuracy you risk p***ing off the user by dumping them out of the session prematurely :-{
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform