Hello I am working on my login.aspx page and I am having trouble validating users. I am not getting any errors but the code is always evaluating to
Code:
Else
            errormessage.Text = "Your email or password is wrong"
        End If
eventhough the email and passwords are correct. I also dont know if this is right but i am using the
Code:
Membership.ValidateUser(email.Text, password.Text)
but using it on a database that i created.




Code:
Protected Sub loginbutton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles loginbutton.Click
        myconnection = New SqlConnection("Server=localhost\SQLEXPRESS;Database=VoteNow;" &
       "Integrated Security=True")
        readata = "(SELECT email,password FROM table2 Where email='@email' and password='@password')"
        mycommand = New SqlCommand(readata, myconnection)
        mycommand.Parameters.AddWithValue("@email", email.Text)
        mycommand.Parameters.AddWithValue("@password", password.Text)
        myconnection.Open()

        If Membership.ValidateUser(email.Text, password.Text) Then
            Response.Redirect("~/Account/myaccount.aspx")
            myreader = mycommand.ExecuteReader(CommandBehavior.CloseConnection)
        Else
            errormessage.Text = "Your email or password is wrong"
        End If
    End Sub
End Class