Validating data is one of the key things in any web application. As a developer you would like to run validation both on the client side (browser) and also on the server side.

So you would probably like to write the validation once and then expect the validation framework to generate the validation logic on both the ends.

Good news, this is possible by using data annotations.

In MVC you validate model values. So once the data comes inside the model you would like to question the model saying, is the data provided proper?, are values in range ? etc.

Data annotations are nothing but the metadata which you can apply on the model and the MVC framework will validate using the metadata provided.