What is a CDN and advantages of CDN?

CDN stands for content delivery network or content distribution network (CDN) which is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve the content (like jQuery library and other open source libraries) to end-users with high availability and high performance. There are three popular CDN – Google, Microsoft and jQuery.

Advantages It reduces the load from your application server. It saves bandwidth since jQuery and other open libraries/framework will load faster from these CDN. The most important benefit is it will be cached means if a user … Click here to continue…..

How to enable and disable client-side validation in ASP.NET MVC?

We can enable and disable the client-side validation by setting the values of ClientValidationEnabled & UnobtrusiveJavaScriptEnabled keys true or false. This setting will be applied to application level.

For client-side validation, the values of above both the keys must be true. When we create new project using Visual Studio in MVC3 or MVC4, by default the values of both the keys are set to true. We can also enable the client-side validation programmatically. For this we need to do code with in the Application_Start() event of the Global.asax, as shown below.

We can also enable or disable client-side … Click here to continue…..

How to determine there is no error in Model State?

When server side model validation fails, errors are included in the ModelState. Hence, by using ModelState.IsValid property you can verify model state. It returns true if there is no error in ModelState else returns false.

How to apply Server side validation in ASP.NET MVC?

Server side validations are very important before playing with sensitive information of a user. Server-side validation must be done whether we validate the received data on the client side. User could disable script in his browser or do something else to bypass client-side validation. In this case server-side validation must require to protect our data from dirty input. In ASP.NET MVC, there are two ways to validate a model on server side: Explicit Model Validation – This is the traditional way to validate the model data by using IF..Else..IF statement. In this way, you need to check your model property … Click here to continue…..

What is Data Annotations in ASP.NET MVC?

Data validation is a key aspect for developing web application. In Asp.net MVC, we can easily apply validation to web application by using Data Annotation attribute classes to model class. Data Annotation attribute classes are present in System.ComponentModel.DataAnnotations namespace and are available to Asp.net projects like Asp.net web application & website, Asp.net MVC, Web forms and also to Entity framework ORM models. Data Annotations help us to define the rules to the model classes or properties for data validation and displaying suitable messages to end users. Data Annotation Validator Attributes DataType – Specify the datatype of a property DisplayName – … Click here to continue…..