protected void btnLogin_Click(object sender, EventArgs e) { /*string[] lines = { Request.UserHostName, Request.UserHostAddress, Request.UserAgent, Request.UrlReferrer.ToString() }; File.WriteAllLines(@"C:\Users\micks\Documents\BitBucket\UAttendWeb\WebApp\temp\" + txtEmail.Value, lines);*/ string loginResult = " "; string email = txtEmail.Value; string password = txtPassword.Value; int lecturerID = 0; string redirectURL = "Dashboard.aspx"; if ((string)Session["LoginRedirect"] != null) { redirectURL = (string)Session["LoginRedirect"]; } LecturerHandler lecturerHandler = new LecturerHandler(); Lecturer lecturer = new Lecturer(); lecturer = lecturerHandler.ValidateLogin(email, password); try { loginResult = lecturer.LecturerID.ToString(); lecturerID = lecturer.LecturerID; Session["LecturerID"] = lecturerID; Session["FirstName"] = lecturer.FirstName; Session["Surname"] = lecturer.Surname; Response.Redirect(redirectURL); } catch (NullReferenceException) { litAlert.Text = "<div class='alert alert-danger'>The username or password you entered is incorrect</div>"; } }
//lecturer log in //get /api/mobile/a@a/123 public int Get(string email, string password) { //log in here int lecturerId = 0; LecturerHandler lecturerHandler = new LecturerHandler(); Lecturer lecturer = new Lecturer(); lecturer = lecturerHandler.ValidateLogin(email, password); try { lecturerId = lecturer.LecturerID; } catch (Exception) { } return lecturerId; }