Being new to ASP.NET MVC, I\'ve been wondering about the signature of Controller methods. In all the examples I\'ve seen, they always seem to return ActionResult, even if th
Yes, you can define your action like: public ViewResult Index(). But sometimes your action can return different results (it is impossible without declaring result as base ActionResult class). For example:
public ActionResult Show()
{
...
if(Request.IsAjaxRequest())
{
return PartialView(...);
}
return View(...);
}
or:
public ActionResult Show()
{
...
try
{
...
}
catch(Exception)
{
return RedirectToAction(...);
}
return View(...);
}