public partial class _Default : System.Web.UI.Page
{
string n,p;
SqlConnection con =new SqlConnection("UR CONNECTION");
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.ViewState["count"] = 0;
}
}
public void m1()
{
con.Open();
SqlCommand com = new SqlCommand("select*from kum where userid='" + TextBox1.Text + "'", con);
SqlDataReader dr;
dr = com.ExecuteReader();
while (dr.Read())
{
n = dr[0].ToString();
p = dr[1].ToString();
}
dr.Close();
if (TextBox1.Text == n && TextBox2.Text == p)
{
Label3.Text = "Valid";
}
else
{
Label3.Text = "invalid";
}
con.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
int i = int.Parse(this.ViewState["count"].ToString())+1;
this.ViewState["count"] = i;
if (i <= 3)
{
for (i = 0; i < 2; i++)
{
m1();
}
}
else
{
Label4.Text = "no";
}
}
}