Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["shopingConnectionString1"].ConnectionString);
  2. string s = "select * from login";
  3. SqlCommand com = new SqlCommand(s, con);
  4. con.Open();
  5. if (con.State == ConnectionState.Open)
  6. {
  7. SqlDataReader dtr;
  8. dtr = com.ExecuteReader();
  9. while (dtr.Read())
  10. {
  11. if (dtr[0].ToString().Equals(TextBox1.Text) && dtr[1].ToString().Equals(TextBox2.Text))
  12. {
  13.  
  14.  
  15. Response.Cookies["uname"].Value = TextBox1.Text;
  16. Response.Cookies["pwd"].Value = TextBox2.Text;
  17. Response.Cookies["role"].Value = dtr[2].ToString();
  18. FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, false);
  19.  
  20. }
  21. else
  22. {
  23. Label1.Text = "your credential are incorrect";
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement