Validations in ASP .NET Core

CodeS
CodeS
2.5 هزار بار بازدید - 3 سال پیش - Previous Part.Net5
Previous Part
.Net5 CRUD using Multiple repositorie...

Image Bank Project
File and Image Upload with JavaScript...

Inventory Project Playlist
Asp net core 5 MVC Tutorial for Begin...



Types of Validations in Asp.Net Core.

There are three types of Validation methods exists in not only  in Asp .NET core but in all Web Based software. Irrespective to the languages
used to develop that Software.

They are
Client Side validations, Server Side Validations and Remote Validations.

1. Client Side validations.
Client side validation is the process to validate the form  
to ensure all required form controls are filled out, in the required and correct format.
This mainly  checks the data formats.
normally this is done by JavaScript.

we are doing this from before the coming of ASP .NET Core
and we are doing it in ASP .NET core also. This will get continued until web based software exists.

But the method of doing client side validations in asp.net core
has changed a lot. In here, we can automate this by using the data annotations class. we have already seen many examples on this in my previous tutorials.

2. Server Side Validations.
Server side validations, we do at server side.
I mean at the controller or in the repository.

Even though all fields of the forms are already validated
at the client side. there exists lot of possibilities to cheat the client side validations by turning off the JavaScript on the browser.

so on Such scenarios, The program saves the not validated data to the persistent store like database. which is high risk for any software.

So to overcome those problems. we use Server side validations.
Server side validations are very important because, it will ensure that
the data passed to the database are valid. and does not break the
data rules and integrity of the database.

3. Remote Validations.

What is remote validation?
Remote validation is the process where we validate specific data
by posting only  that data to a server without
posting the entire form data to the server.

This normally we do using partial post or AJAX.

It is very useful on checking for the  duplicates.

for example,
During a user registration
process. it would be very nice if we
show the error message to the user in advance
that  the entered userid is Already Taken.

instead of redirecting him to the error page
after submitting the form.

This is a very interesting video. so watch and enjoy.

Happy coding.

by the way don't forget to Like & Share.

Do Subscribe and press the bell icon for More Videos.

Thank You
-Aniz
3 سال پیش در تاریخ 1400/11/29 منتشر شده است.
2,595 بـار بازدید شده
... بیشتر