动作方法

2018-06-17 23:06:04来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

1.View方法

public ActionResult Index()
{
    //完整路径
    return View("~/Areas/Admin/Views/Home/Index.cshtml");
}

 

ActionResult解析:(抽象类)视图结果
子类:

System.Web.Mvc.ContentResult:ContentResult Controller.Content("") 向用户输出字符串,没有多余的文本
System.Web.Mvc.EmptyResult: 返回空内容,Controller没有提供方法
System.Web.Mvc.FileResult(抽象): 返回一个文件,用于验证码
FileContentResult(子类): Controller.File(new byte[],""); e.g return new FileContentResult(new byte[1024],"image/jpeg");
FilePathResult(子类): Controller.File("",""); e.g return new FilePathResult("logo.jpg","image/jpeg");
FileStreamResult(子类):e.g return new FileStreamResult(new FileStream("logo.jpg",FileMode.Open),"image/jpeg")
System.Web.Mvc.ViewResult:

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:2017年10月21日 CSS常用样式&鼠标样式 以及 jQuery鼠标事件

下一篇:ASP.NET没有魔法——ASP.NET MVC路由