protected void actionLoginButtonClicked(object sender, EventArgs e) { AuthenticationController authController = new AuthenticationController(); User user = authController.actionCheckLoginData(ui_username_textbox.Text, ui_password_textbox.Text); if (user == null) { Response.Cookies.Add(new HttpCookie("flash_message", "Username or Password is incorrect.") { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" }); //Response.Redirect("~"); return; } Session["user"] = null; Session["user"] = user; redirectByUserType(user.user_type); }
protected void Page_Load(object sender, EventArgs e) { String username = Request.Form["username"]; String password = Request.Form["password"]; AuthenticationController authController = new AuthenticationController(); User user = authController.actionCheckLoginData(username, password); if (user == null || (user.user_type != 1 && user.user_type != 2)) { Response.Cookies.Add(new HttpCookie("flash_message", "Invilid Login.") { Path = "/" }); Response.Cookies.Add(new HttpCookie("flash_css", "alert alert-error") { Path = "/" }); Response.Redirect("~/m/Login.aspx"); return; } Session["user"] = null; Session["user"] = user; redirectByUserType(user.user_type); }