protected void Page_Load(object sender, EventArgs e) { lbl_Result.Text = ""; HttpCookie p5C = Request.Cookies["P5-A9A10-Cookie"]; if (p5C == null || p5C["Username"] == "" && p5C["Password"] == "") {//New User... Response.Redirect("~/Login.aspx"); } else {//Retrieve existing username and password from cookie. //txt_loginUser.Text = p5C["Username"]; //txt_loginPass.Text = p5C["Password"]; if (accountService.ValidateStaff(p5C["Username"], p5C["Password"])) {//Valid //Response.Redirect("~/Login.aspx"); } else if (accountService.ValidateUser(p5C["Username"], p5C["Password"])) {//Valid } else { Response.Redirect("~/Login.aspx"); } } int sessionCounter = (int)Application["SessionCounter"]; lbl_SessionCount.Text = "Session counter is: " + sessionCounter; }
protected void Page_Load(object sender, EventArgs e) { lbl_result.Text = "";//<p>For member testing use Username:Test Password:Test</p><p>For staff testing use Username:TA Password:Cse445ta!</p>"; lbl_result2.Text = ""; //Cookies!: HttpCookie p5C = Request.Cookies["P5-A9A10-Cookie"]; if (p5C == null || p5C["Username"] == "" || p5C["Password"] == "") {//New User... lbl_result.Text = "Welcome New User!"; } else { //Retrieve existing username and password from cookie. if (!validateService.ValidateStaff(p5C["Username"], p5C["Password"]) || !validateService.ValidateUser(p5C["Username"], p5C["Password"])) { //Expire the cookie if it is invalid. p5C.Expires = DateTime.Now.AddDays(1d); Response.Cookies.Add(p5C); } else { //Have user click in order to use regular login system. txt_loginUser.Text = p5C["Username"]; txt_loginPass.Text = SecurityManager.Decrypt(p5C["Password"]); //2b by Tydin Jarman } } }
protected void Page_Load(object sender, EventArgs e) { lblConvertedTemp.Text = ""; //Cookies: HttpCookie p5C = Request.Cookies["P5-A9A10-Cookie"]; if (p5C == null || p5C["Username"] == "" && p5C["Password"] == "") {//New User... Response.Redirect("~/Login.aspx"); } else {//Retrieve existing username and password from cookie. //txt_loginUser.Text = p5C["Username"]; //txt_loginPass.Text = p5C["Password"]; if (accountService.ValidateStaff(p5C["Username"], p5C["Password"])) {//Valid } else if (accountService.ValidateUser(p5C["Username"], p5C["Password"])) {//Valid } else { Response.Redirect("~/Login.aspx"); } } }