private void Login_(string nome, string psw) { if (nome != null && nome.Length > 4 && psw != null && psw.Length > 1 && ControllaCredenziali(nome, psw)) { var p = MapPath("App_Data"); var f = System.IO.Path.Combine(p, nome); GB.Instance.setCurrentSession(Session, new cSession()); GB.Instance.getCurrentSession(Session).LoggedIN = true; GB.Instance.getCurrentSession(Session).UserName = nome; GB.Instance.getCurrentSession(Session).PathDB = f + ".rqd8"; if ("1".Equals(cbMemorizza.Value)) { var n = new string[] { "AutoLogin_UserName", "AutoLogin_UserPassword", "AutoLogin" }; var c = new string[] { nome, psw, "TRUE" }; GB.SetCookie(Response, n, c); } else { DeleteCookieLogin(false); } Response.Redirect("mMenu.aspx"); } else { lErrore.Text = "Credenziali d'accesso errate!"; } }
private void DeleteCookieLogin(bool clearSession) { var n = new string[] { "AutoLogin_UserName", "AutoLogin_UserPassword", "AutoLogin" }; var c = new string[] { "", "", "FALSE" }; eUtente.Text = ""; ePsw.Text = ""; cbMemorizza.Value = "0"; GB.SetCookie(Response, n, c); if (clearSession) { GB.Instance.setCurrentSession(Session, null); } }