Login is not working
<p>I have written the code below for a login page, but doesn't seem to work.<br>
The variable <code>temp</code> takes a value of <code>0</code>.</p>

<pre><code>protected void ButtonSbmt_Click(object sender, EventArgs e) {
    //if (IsPostBack) {
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegConnectionString"].ConnectionString);
    conn.Open();
    string cmdstr = "select count(*) from Registration where username='" + TextBoxUsername.Text + "'";
    SqlCommand checkuser = new SqlCommand(cmdstr, conn);       

    int temp = Convert.ToInt32(checkuser.ExecuteScalar().ToString());

    if (temp == 1) {

        string str = "select password from Registration where username='" + TextBoxUsername.Text + "'";

        SqlCommand pass = new SqlCommand(str, conn);
        string pass1 = pass.ExecuteScalar().ToString();
        conn.Close();

        if (pass1 == TextBoxPassword.Text) {
            Session["new"] = TextBoxUsername.Text;
            Response.Redirect("secure.aspx");
        } else {
            Label1.Visible = true;
            Label1.Text = "invalid password";
        }     
    }
}
</code></pre>
