码迷,mamicode.com
首页 > Web开发 > 详细

ASP.NET mvc下在Controller下action的跳转方式

时间:2015-04-10 20:08:51      阅读:260      评论:0      收藏:0      [点我收藏+]

标签:

在ASP.NET mvc下,action有多种挑战方式:

return RedirectToAction("Index");//一个参数时在本Controller下

如果RedirectToAction(ActionName,ControllerName) //可以直接跳到别的Controller. return RedirectToRoute(new {controller="Home",action="Index"});//可跳到其他controller Response.Redirect("Index");//适用于本controller下的方法名称。返回值为void return Redirect("Index");//适用于本controller下的方法名称。

return View("Index"); //直接显示对应的页面不经过执行Controller的方法。 return View("~/Views/Home/Index.aspx");//这种方法是写全路径,直接显示页面,不经过Controller方法 return View();//直接显示页面,不经过Controller方法

ASP.NET mvc下在Controller下action的跳转方式

标签:

原文地址:http://www.cnblogs.com/yonguibe/p/4415355.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!