Reputation: 4333
I am trying to add remote validation for old password in the Account view (ChangePassword section).
I have a viewmodel Areas/Private/ViewModels/Account/ChangePasswordViewModel.cs
which contains the OldPassword
field:
[Remote("IsPasswordValid", "Account", HttpMethod="Post", ErrorMessage="Wrong password")]
public string OldPassword { get; set; }
And a controller Areas/Private/Controllers/AccountController.cs
which contains the action for the validation:
// ...
[Area("Private")]
// ...
public JsonResult IsPasswordValid(string pwd) {
return Json(true);
}
When I run the project and inspect the OldPassword field I notice the following data-val-remote-url:
/Private/Account/Index?action=IsPasswordValid&controller=Account
which ofcourse doesn't work. I expected to see the following url:
/Private/Account/IsValidPassword
Am I missing something here?
Upvotes: 1
Views: 129