Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Page_Load(object sender, EventArgs e)
- {
- SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["FARMConnectionString"].ConnectionString);
- conn.Open();
- string checkuser = "select count(*) from colaboradores where nrColaborador='" + TextBox1.Text + "'";
- SqlCommand com = new SqlCommand(checkuser, conn);
- int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
- conn.Close();
- if (temp == 1)
- {
- conn.Open();
- string checkPasswordQuery = "select psw from colaboradores where nrColaborador='" + TextBox1.Text + "'";
- SqlCommand passCom = new SqlCommand(checkPasswordQuery, conn);
- string password = passCom.ExecuteScalar().ToString().Replace(" ", " ");
- if (password == TextBox2.Text)
- {
- Session["New"] = TextBox1.Text;
- FormsAuthentication.RedirectFromLoginPage(temp.ToString(), true);
- Response.Redirect("Menu.aspx");
- }
- else
- {
- Response.Write("Username ou Password errados");
- }
- }
- }
- <requestLimits maxUrl="10999" maxQueryString="2097151" />
- <authentication mode="Forms">
- <forms loginUrl="Login.aspx" defaultUrl="Menu.aspx"/>
- </authentication>
- <authorization>
- <deny users="?"/>
- </authorization>
Add Comment
Please, Sign In to add comment