protected void Button2_Click(object sender, EventArgs e) { if (TextBox1.Text != null) { string cat = string.Empty; string un = TextBox1.Text; string pwd = TextBox2.Text; bl c = new bl(); try { cat = c.verpwd(un, pwd); } catch { cat = null; } if (cat == "") { Response.Write("<script>alert('Invalid Username / Password');</script>"); } else { Session["username"] = TextBox1.Text; Server.Transfer("main.aspx"); } } }