public Boolean logoutUser() { String username = getNid(); if (username != null) { // save user in database users[] author_list = ActiveRecordBase <users> .FindAll(); users temp = null; foreach (users author in author_list) { if (!string.IsNullOrEmpty(author.nid) && author.nid.ToUpper() == username.ToUpper()) { temp = author; } } if (temp != null) { temp.loggedin = false; temp.Save(); return(temp.loggedin); } return(true); } return(false); }
public void logout() { String username = Authentication.authenticate(); Authentication.logout(); // save user in database users[] author_list = ActiveRecordBase <users> .FindAll(); users temp = null; foreach (users author in author_list) { if (!string.IsNullOrEmpty(author.nid) && author.nid.ToUpper() == username.ToUpper()) { temp = author; } } temp.loggedin = false; temp.Save(); HttpContext.Session.Abandon(); HttpContext.Response.Redirect("~/admin", false); HttpContext.ApplicationInstance.CompleteRequest(); return; }
public Boolean loginUser() { String username = getNid(); // save user in database users[] author_list = ActiveRecordBase <users> .FindAll(); users foundUser = null; foreach (users author in author_list) { if (!string.IsNullOrEmpty(author.nid) && author.nid.ToUpper() == username.ToUpper()) { foundUser = author; } } if (foundUser != null) { foundUser.loggedin = true; foundUser.Save(); return(foundUser.loggedin); } return(false); }