March 24, 2016 by Anuraj Estimated read time : 2 mins
ASP.NET MVCASP.NET CoreASP.NET5Remote Validation
Remote validation allows the developer to call the controller actions using client side script. This is extremely useful when you want to perform a back end query without having to perform a full server postback. ASP.NET MVC Remote configuraion helps us to do this by decorating the model properties with remote attribute. This post is about implementing remote validation in ASP.NET Core. For remote validation first you need to decorate the model class property with remote attribute.
The ValidateEmailAddress is an action method in Home controller, which returns true if the email address not exists in the database and if exists it returns a string which will displayed in the view. Here is the controller method.
_repository is a repository implementation, which will be injected in the controller constructor. And here is the view.
You need to add few script references to make remote attribute work properly.