MVC Acceptverbs yog dab tsi?
MVC Acceptverbs yog dab tsi?

Video: MVC Acceptverbs yog dab tsi?

Video: MVC Acceptverbs yog dab tsi?
Video: Leveraging the power of ActionName and AcceptVerbs in Asp.Net MVC 2024, Hlis ntuj nqeg
Anonim

Cov [ AcceptVerbs ] tus cwj pwm tuaj yeem siv rau txoj hauv kev ua haujlwm hauv tus maub los kom cov txheej txheem overloaded tsim nyog raug hu rau qhov kev thov. ASP. NET MVC yuav cia li xa ib daim ntawv thov mus rau txoj kev ua kom tsim nyog raws li HTTP verb.

Tom qab ntawd, ib tus kuj yuav nug, HTTP verbs MVC yog dab tsi?

MVC lub moj khaum txhawb kev sib txawv ActionVerbs, xws li HttpGet, HttpPost, HttpPut, HttpDelete, HttpOptions & HttpPatch. Koj tuaj yeem siv cov cwj pwm no rau txoj hauv kev los qhia txog hom Http thov cov txheej txheem kev txhawb nqa. Yog tias koj tsis siv ib qho cwj pwm ces nws suav tias nws yog GET thov los ntawm lub neej ntawd.

Ib yam li ntawd, cov lus qhia ua haujlwm hauv MVC yog dab tsi? Tus nto moo Action Verbs txhawb los ntawm MVC lub moj khaum yog HttpGet, HttpPost, HttpPut, HttpDelete, HttpOptions & HttpPatch. Hauv MVC Lub moj khaum, yog tias koj tsis siv tej yam ntxwv ntawm txoj kev, los ntawm lub neej ntawd, nws txiav txim siab GET thov txoj kev.

Ua raws li qhov xav tau, siv HttpPost hauv MVC yog dab tsi?

HttpGet thiab HttpPost , ob qho tib si yog txoj kev tshaj tawm cov ntaub ntawv tus neeg siv khoom lossis cov ntaub ntawv rau cov neeg rau zaub mov. HTTP yog HyperText Transfer Protocol uas yog tsim los xa thiab txais cov ntaub ntawv ntawm tus neeg siv khoom thiab cov neeg siv khoom siv cov nplooj ntawv web.

Yuav ua li cas muaj ntau yam lus qhia muaj nyob rau hauv MVC?

Ntawm no, hauv ASP. NET MVC , peb muaj tsawg action verbs tab sis lawv tau siv dav hauv Web APIs. Tab sis ntawm no, hauv MVC , peb ib txwm siv ob action verbs.

Pom zoo: