I am having a problem using the remote property of the data-anotation.
I am having a model for user which stores the data:
[DataType(DataType.EmailAddress,ErrorMessage="please enter valid email")]
[DisplayName("Email Address")]
[Required(ErrorMessage = "Email is Required")]
[Remote("CheckUniqueEmail","User",ErrorMessage="An account with this email address already exists.")]
public string Email { get; set; }
and I am checking the distinct user email while creating the new one…
When I try to login with the email and password in the different controller, it still calls the Remote and checks for the unique email…
I think I have to exclude the email and password property in the Login controller – but I don’t know how.
You should use another model for logging in at LoginController.
These validations will be used everywhere you use this model.