use*_*949 3 asp.net-mvc asp.net-mvc-2
我想知道如果没有涉及视图,控制器是否可以完全替换http处理程序.功能看起来很相似.
当然:
public ActionResult Index()
{
return Content("No view involved here", "text/plain");
}
Run Code Online (Sandbox Code Playgroud)
要么:
public ActionResult Index()
{
return File("test.pdf", "application/pdf");
}
Run Code Online (Sandbox Code Playgroud)
要么:
public ActionResult Index()
{
return Json(new { foo = "bar" });
}
Run Code Online (Sandbox Code Playgroud)
在所有这些例子中,没有涉及的观点.控制器充当HTTP处理程序.
| 归档时间: |
|
| 查看次数: |
473 次 |
| 最近记录: |