Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- get user specific information from database after login
- protected void Button1_Click(object sender, EventArgs e)
- {
- SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RegConnectionString"].ConnectionString);
- con.Open();
- string cmdStr = "select count (*) from Registration where UserName ='" + TextBox1.Text + "'";
- SqlCommand checkuser = new SqlCommand(cmdStr, con);
- int temp = Convert.ToInt32(checkuser.ExecuteScalar().ToString());
- if (temp == 1)
- {
- String cmdStr2 = "select password from Registration where UserName ='" + TextBox1.Text + "'";
- SqlCommand pass = new SqlCommand(cmdStr2, con);
- String password = pass.ExecuteScalar().ToString();
- con.Close();
- if (password == TextBox2.Text)
- {
- Session["New"] = TextBox1.Text;
- Response.Redirect("secure.aspx");
- }
- else
- {
- Label1.Visible = true;
- Label1.Text = "Invalid Password....!!!";
- }
- }
- else
- {
- Label1.Visible = true;
- Label1.Text = "Invalid UserName....!!!";
- }
- }
Add Comment
Please, Sign In to add comment