c# - Session login not logging out on button click -
i have site stores variables on user login, db. 1 such variable (on successful login) sitesession.current.isloggedin = true
.
when click logout button, method tells set false
, proceed session.clear()
, session.abandon()
.
up now, have click logout button twice before changes made.
tested response.write(sitesession.current.isloggedin);
in logout()
method.
the first click doesnt show anything, second click shows false
.
could tell me i;m going wrong?
/// <summary> /// logs user out, , destroys session /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkaccountlogout_click(object sender, eventargs e) { sitesession.current.isloggedin = false; sitesession.current.rollid = "-1"; session.clear(); session.abandon(); response.write(sitesession.current.isloggedin); }
~ login opposite that, whilest storing few more variables.
edit: if reload page after click first time, nothing happens.
it may cost time store changes in db. try let run in thread , let thread wait till isloggedin true.
i hope helps =)