Guest User

Untitled

a guest
Apr 14th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["FARMConnectionString"].ConnectionString);
  4. conn.Open();
  5. string checkuser = "select count(*) from colaboradores where nrColaborador='" + TextBox1.Text + "'";
  6. SqlCommand com = new SqlCommand(checkuser, conn);
  7. int temp = Convert.ToInt32(com.ExecuteScalar().ToString());
  8. conn.Close();
  9. if (temp == 1)
  10. {
  11. conn.Open();
  12. string checkPasswordQuery = "select psw from colaboradores where nrColaborador='" + TextBox1.Text + "'";
  13. SqlCommand passCom = new SqlCommand(checkPasswordQuery, conn);
  14. string password = passCom.ExecuteScalar().ToString().Replace(" ", " ");
  15.  
  16. if (password == TextBox2.Text)
  17. {
  18. Session["New"] = TextBox1.Text;
  19.  
  20. FormsAuthentication.RedirectFromLoginPage(temp.ToString(), true);
  21. Response.Redirect("Menu.aspx");
  22. }
  23. else
  24. {
  25. Response.Write("Username ou Password errados");
  26. }
  27. }
  28. }
  29.  
  30. <requestLimits maxUrl="10999" maxQueryString="2097151" />
  31.  
  32. <authentication mode="Forms">
  33. <forms loginUrl="Login.aspx" defaultUrl="Menu.aspx"/>
  34. </authentication>
  35.  
  36. <authorization>
  37. <deny users="?"/>
  38. </authorization>
Add Comment
Please, Sign In to add comment