Asp.net mvc 行动结果是什么?
据我所知,它是一个可以返回视图的类 因为在某些动作的基础上,我试图执行一个视图 请确认它是否正确。是Asp.net mvc 行动结果是什么?,asp.net-mvc,asp.net-mvc-3,Asp.net Mvc,Asp.net Mvc 3,据我所知,它是一个可以返回视图的类 因为在某些动作的基础上,我试图执行一个视图 请确认它是否正确。是 Encapsulates the result of an action method and is used to perform a framework-level operation on behalf of the action method. 是的 Encapsulates the result of an action method and is used to perform a
Encapsulates the result of an action method and is used to perform a framework-level operation on behalf of the action method.
是的
Encapsulates the result of an action method and is used to perform a framework-level operation on behalf of the action method.
ActionResult
是各种结果的基类,可以从操作方法返回。它不一定是一个视图。行动结果可能是什么,有很多选择:
-用户定义的内容ContentResult
-仅为空EmptyResult
-二进制文件FileResult
-特定的HTTP响应状态代码和说明HttpStatusCodeResult
-js代码JavaScriptResult
-格式化为JSON的数据JsonResult
-重定向到url重定向结果
-重定向到某个MVC路由RedirectToRouteResult
-这实际上就是视图ViewResult
-局部视图局部视图
public ActionResult MyAction()
{
if(someCondition)
return View(); // return the view from action
else
return RedirectToAction("SomeOtherAction","OnSomeOtherController"); // redirect to other action
}
ActionResult
是各种结果的基类,可以从操作方法返回。它不一定是一个视图。行动结果可能是什么,有很多选择:
-用户定义的内容ContentResult
-仅为空EmptyResult
-二进制文件FileResult
-特定的HTTP响应状态代码和说明HttpStatusCodeResult
-js代码JavaScriptResult
-格式化为JSON的数据JsonResult
-重定向到url重定向结果
-重定向到某个MVC路由RedirectToRouteResult
-这实际上就是视图ViewResult
-局部视图局部视图
public ActionResult MyAction()
{
if(someCondition)
return View(); // return the view from action
else
return RedirectToAction("SomeOtherAction","OnSomeOtherController"); // redirect to other action
}