protected void Button1_Click(object sender, EventArgs e) { String post, branch; if (Page.IsValid) { String password = Encrypt(TextBox_password.Text); String name; if (RadioButtonList1.SelectedValue == "Student") { name = Data_Access.Login(TextBox_ID.Text, password, 1, out post, out branch); if (name == "") { Response.Write("ID not registered"); } else if (name == "Invalid Password") { Response.Write(name); } else { Session["student_name"] = name; Session["sap_id"] = TextBox_ID.Text; FormsAuthentication.RedirectFromLoginPage(name, false); Response.Redirect("Home_Student/Leave_Apply.aspx"); } } else { name = Data_Access.Login(TextBox_ID.Text, password, 0, out post, out branch); if (name == "") { Response.Write("Employee ID not registered"); } else if (name == "Invalid Password") { Response.Write(name); } else { Session["employee_name"] = name; Session["emp_id"] = TextBox_ID.Text; Session["post"] = post; Session["branch"] = branch; FormsAuthentication.RedirectFromLoginPage(name, false); if (Session["post"].ToString() == "gate_check") { Response.Redirect("Gate_Check.aspx"); } else if (Session["post"].ToString() == "warden") { Response.Redirect("Hostel_Check_Leave.aspx"); } else { Response.Redirect("Employee_Check_Leave.aspx"); } } } } }