Action methods

Controller actions are methods responsible to perform required operation on user input. These are also called built in ActionResult

ViewResult renders the specified or default view.

PartialViewResult renders the specified or default partial view.

JsonResult

JavaScriptResult

FileResult

ActionResult

ActionResult class is the base class for all action results. So when your action method returns multiple results based on different conditions, ActionResult is the best choice.

Non-Action method

All public methods of a controller class as action methods in MVC. use [NonAction] attribute to make it non action.

How to restrict an action method to be invoked only by HTTP GET, POST, PUT or DELETE?

By default each action method is invoked by get, put, etc. We can restrict it by using http attribute line [HttpGet]

results matching ""

    No results matching ""