Question

If I have an action method that I know it will only be called via AJAX and always returning JSON...

Do I set the method return type to JsonResult or leave it to ActionResult?

Please explain the reason of the choice.

Was it helpful?

Solution

You should declare your action methods as returning ActionResult, so that they have the freedom to return any concrete result class.

Check this answer: https://stackoverflow.com/a/15250991/7720

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top