Hi there,
You need to make sure that your query returns a record, before you try to access it. You can do this by checking the return value of the Read method. Try this:
Code:
if (reader.Read())
{
if (txtPass.Text == reader["Pass"].ToString())
{
FormsAuthentication.RedirectFromLoginPage(txtUser.Text, false);
}
else
{
loginfailed.Text = "Reader Invalid Login";
}
}
reader.Close();
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to:
Praise You by
Fatboy Slim (From the album:
You've Come a Long Way, Baby)
What's This?