Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Logging user in and out
Message
Information générale
Forum:
ASP.NET
Catégorie:
MVC
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01597445
Message ID:
01597491
Vues:
40
>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 :-{
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform