Asp.net Mvc Framework可以在Controller中使用的Url.Action方法
来源:互联网 发布:淘宝不能支付怎么回事 编辑:程序博客网 时间:2024/05/01 08:15
原本的Url.Action方法是利用RouteCollection来实现Url的Routing的。
所以这里用一个扩展方法重现一下- using System.Web.Routing;
- static public class CUrl {
- public static string Action(this Controller c, string controller, string action) {
- RouteValueDictionary rvd = new RouteValueDictionary();
- rvd.Add("controller", controller);
- rvd.Add("action", action);
- return RouteTable.Routes.GetVirtualPath(c.ControllerContext, rvd).VirtualPath;
- }
- }
- public ActionResult Index() {
- ViewData["Message"] = this.Action("home", "about");
- return View();
- }
- Asp.net Mvc Framework可以在Controller中使用的Url.Action方法
- Asp.net Mvc Framework可以在Controller中使用的Url.Action方法
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、controller、action
- 在ASP.NET MVC 中获取当前URL、Controller、Action(集)
- 如何在ASP.NET MVC 中获取当前URL、controller、action
- ASP.NET MVC 中 当前controller、action的获取
- 在ASP.NET MVC的Controller Action中获取客户端请求数据
- 在 ASP.NET MVC 中使用带后缀的 URL
- .net mvc 获取url中controller和action
- IBM Message Broker笔记系列(九)
- select 下拉菜单取值问题
- 软件方法论
- Oracle中分页查找语句的实现
- 父窗体获取子窗体的选择数据
- Asp.net Mvc Framework可以在Controller中使用的Url.Action方法
- 利用其他表的数据update当前表
- 有关构造器的代码
- DecimalFormat的使用
- Jakarta Commons BeanUtils
- VBS 汉字转拼音
- 2008年07月30日-奥运会第一次彩排
- BeanUtils--org.apache.commons.beanutils.BeanUtils
- StringWriter/PrintWriter