public SessionContent CreateSession(string name, string password) { try { var code = SessionKeeper.AddSession(name, password); return(code == null ? SessionContent.Error : new SessionContent { Name = name, SessionKey = code }); } catch { return(SessionContent.Error); } }
public IActionResult Login(string name, string pass) { if (pass == null || name == null) { return(View()); } var code = SessionKeeper.AddSession(name, pass); if (code != null) { Response.Cookies.Append("Name", name); Response.Cookies.Append("SessionKey", code); } else { return(View()); } return(Redirect("/Home/Index")); }