You have declared an object as follows:
krs_userinfo k = new krs_userinfo();
But, as you haven't retrieved this object from the database, this is a blank object. So, the next if statement always evaluates to
false
.
if(TextBox1.Text.Equals(k.uname) && (TextBox2.Text.Equals(k.password)))
What you might need is something like as follows:
krs_userinfo k = GetUserFromDBByUserNameAndPassword(TextBox2.Text,TextBox2.Text);
if(k != null)
{
Response.Redirect("~/Quizaspx.aspx");
}
So, you just need to implement the method
GetUserFromDBByUserNameAndPassword(userName,password)
which will query the database to retrieve the user object with the supplied
userName
and
password
.