ModelState.IsValid is always returning false [duplicate]

ModelState.IsValid will be false if the validation for the Model failed.

  1. You have DataAnnotation which failed the incoming model.
  2. You added custom validations.
  3. Make sure there are no null entries in the model for non null properties

Check the ModelState.Errors for what is the reason causing this. You can use this:

var errors = ModelState.Values.SelectMany(v => v.Errors);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)