protected void Login_Clicked(object sender, EventArgs e) { string userID = dropUserId.Text.ToString(); string password = txtPassword.Text.ToString(); bool loginStatus = false; Debug.WriteLine("UserID is: " + userID); Debug.WriteLine("Password is: " + password); if (userID != "Select UserID" && userID != "") { DatabaseConnectivity dbcon = new DatabaseConnectivity(); List <User> userList = dbcon.getAuthUsers(); foreach (var item in userList) { if (userID.Equals(item.UserID) && password.Equals(item.Password)) { loginStatus = true; Session["UserID"] = userID; break; } else { } } if (loginStatus) { lblStatus.Text = "Response Code: "; lblStatusCode.Text = "0200"; Response.Redirect("~/ProtectedPages/Dashboard.aspx"); } else { lblStatus.Text = "Response Code: "; lblStatusCode.Text = "0401"; } } else { lblStatus.Text = "Response Code: "; lblStatusCode.Text = "0401"; } }