javascript - Automatically log out users when tab is closed using asp.net forms authentication -


i have simple web form uses forms authentication. implement authentication, have in web.config

<system.web>     <authentication mode="forms">         <forms loginurl="logon.aspx" name=".aspxformsauth"></forms>     </authentication>     <authorization>         <deny users="?"/>     </authorization>    </system.web>  

and in codebehind on logon.aspx use let them form if credentials work:

formsauthentication.redirectfromloginpage(formid, false); 

formid identifier either generated on logon page new form, or entered user continue existing form. when complete form or click button start new form use send them logon page:

formsauthentication.signout(); 

the issue i'm worried users might lose track of formid they're working on, , fill out information wrong id (it displayed on form them, might ignore it). want automatically sign them out whenever refresh page, close tab, or close browser (thus forcing them explicitly enter id continue form). current code, sign them out when close browser, not when close tab or refresh page.

is there way me detect tab closing or refresh , sign them out? either code behind or javascript?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -