Dab tsi yog server sab validation hauv MVC?
Dab tsi yog server sab validation hauv MVC?

Video: Dab tsi yog server sab validation hauv MVC?

Video: Dab tsi yog server sab validation hauv MVC?
Video: UA LI CAS THIAJ TSI MUAJ MENYUAM 2024, Kaum ib hlis
Anonim

Kab lus no piav qhia txog lub hauv paus ntawm ASP. NET MVC server - sab validation siv Data Annotation API. Lub ASP. NET MVC Lub moj khaum validates cov ntaub ntawv dhau mus rau tus tswj kev txiav txim uas yog executing, Nws populates ib ModelState kwv nrog ib yam kev lees paub ua tsis tiav uas nws pom thiab dhau qhov khoom ntawd mus rau tus tswj.

Kuj paub, dab tsi yog server sab validation?

Tus neeg siv nkag kev lees paub uas yuav siv qhov chaw ntawm lub server sab thaum lub sij hawm tom qab kev sib tham yog hu ua server - sab validation . Cov lus xws li PHP thiab ASP. Net siv server - sab validation . Ntawm qhov tod tes, tus neeg siv nkag kev lees paub uas yuav siv qhov chaw ntawm lub neeg sab hu ua tus neeg siv khoom - sab validation.

Ib yam li ntawd, kev lees paub tej thaj chaw deb hauv MVC yog dab tsi? Chaw taws teeb validation yog siv los hu rau server siv tau cov ntaub ntawv tsis tau tshaj tawm tag nrho daim ntawv rau lub server thaum server sab kev lees paub yog preferable rau tus neeg sab nrauv. Nws yog txhua yam ua tiav los ntawm kev teeb tsa tus qauv thiab cov tswj hwm uas zoo nkauj zoo nkauj.

Kuj kom paub, dab tsi yog tus neeg siv khoom sab thiab server sab validation hauv MVC?

Client side validation Vs server sab validation Tus neeg siv nkag kev lees paub coj qhov chaw ntawm Server Side thaum lub sij hawm xa rov qab kev sib tham yog hu Server Side Validation thiab tus neeg siv tswv yim kev lees paub coj qhov chaw ntawm Client Side (web browser) hu ua Client Side Validation.

Vim li cas peb thiaj xav tau server sab validation?

Txhawm rau muab kev tawm tswv yim tam sim. Cov neeg siv- sab validation muab cov lus qhia tam sim rau tus neeg siv yam tsis tas yuav tos rau nplooj ntawv thauj khoom. Txawm li cas los xij, yog tias tus neeg siv khoom tsis ua haujlwm - sab scripts (piv txwv li JavaScript disabled), lub kev lees paub yuav tsis tua hluav taws uas yog vim li cas koj xav tau tus server los xyuas qhov tseem ceeb thiab.

Pom zoo: