Posted by Anuraj on Thursday, March 24, 2016 Reading time :1 minute
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.
Here is the screenshot of the application
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.