ASP.NET mvc下action的跳转方式
2015-08-23 20:09
656 查看
在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方法
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 开发必备知识点(1):如何让Asp.net网站运行在自定义的Web服务器上
- ASP.NET MVC Web API 学习笔记---第一个Web API程序
- ASP.NET 4.0引入的视图状态属性ViewStateMode与原EnableViewState的区别
- Win7/Win8/IIS7/IIS8配置ASP/ACCESS
- ASP.NET - GridView实现点击编辑列
- ASP.NET(3)——总结
- Spring AOP + AspectJ in XML configuration example
- Spring AOP + AspectJ annotation example
- asp 支付宝 企业版 接口 支持网银接口 ,网银直接支付
- AspectJ在测试中的应用
- 7 天玩转 ASP.NET MVC — 第 6 天
- 7 天玩转 ASP.NET MVC — 第 6 天
- asp.net(C#)利用QRCode生成二维码---.NET菜鸟的成长之路
- asp.net mvc @Html.Raw 作用
- asp.net page 生命周期事件-1
- ASP.Net发布到IIS中出现错误: 处理程序"PageHandlerFactory-Integrated"在其模块列表中有一个错误模块"ManagedPipelineHandler"
- ASP.NET MVC 4 插件化架构简单实现-思路篇
- ASP.NET MVC 4 插件化架构简单实现-思路篇
- ASP.NET Web API实践系列09,在Fiddler和控制台中模拟GET和POST请求
- ASP.NET MVC URL重写与优化(进阶篇)-继承RouteBase玩转URL