Q.What are different return types of a controller action method?
Answer: There are total nine return types we can use to return results from controller to view. The base type of all these result types is ActionResult.
- ViewResult (View): View Result is used to return a webpage from an action method.
- PartialviewResult (Partialview): PartialViewResult is used to send a part of a view which will be rendered in another view.
- RedirectResult (Redirect): RedirectResult is used to redirect to any other controller and action method depending on the URL.
- RedirectToRouteResult (RedirectToAction, RedirectToRoute): This return type is used when we want to redirect to any other action method.
- ContentResult (Content): RedirectToRouteResult is used to return HTTP content type like text/plain as the result of the action.
- jsonResult (json): jsonResult is used when we want to return a JSON message.
- javascriptResult (javascript): javascriptResult is used to return JavaScript code that will run in browser.
- FileResult (File): FileResult is used to send binary output in response.
- EmptyResult: EmptyResult is used to return nothing (void) in the result.
kuşadası
ReplyDeletemilas
çeşme
bağcılar
zonguldak
WB4