InterviewSolution
| 1. |
How Can We Restrict Mvc Actions To Be Invoked Only By Get Or Post? |
|
Answer» We can DECORATE the MVC ACTION by “HttpGet” or “HttpPost” attribute to restrict the type of HTTP CALLS. For instanceyou can see in the below code SNIPPET the “DisplayCustomer” action can only be invoked by “HttpGet”. If we try tomake Http post on “DisplayCustomer” it will throw an error. We can decorate the MVC action by “HttpGet” or “HttpPost” attribute to restrict the type of HTTP calls. For instanceyou can see in the below code snippet the “DisplayCustomer” action can only be invoked by “HttpGet”. If we try tomake Http post on “DisplayCustomer” it will throw an error. |
|