I'm trying to validate email using this remote validation attribute, but I keep getting this error. Does anyone know the exact reason for this?
public class StudentVm
{
public string Id { get; set; }
[Required]
public string Name { get; set; }
[Remote( "Test", "Validation", HttpMethod = "POST", ErrorMessage = "Invalid Email.")]
public string Email { get; set; }
}
//The validation controller
[Route("Validation/[action]")]
public class ValidationController : Controller
{
[HttpPost]
public async Task<IActionResult> Test(string Email)
{
return Json(false);
}
}
Error
An unhandled exception occurred while processing the request. TypeLoadException: Could not load type 'System.Web.Routing.RouteValueDictionary' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'