I want to know if controll开发者_Go百科er can fully replace http handler when no view involved. The function looks similar.
Sure:
public ActionResult Index()
{
return Content("No view involved here", "text/plain");
}
or:
public ActionResult Index()
{
return File("test.pdf", "application/pdf");
}
or:
public ActionResult Index()
{
return Json(new { foo = "bar" });
}
In all those examples, there's no view involved. The controller acts as an HTTP handler.
精彩评论