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
Post a Comment