Url.Action不发送路由参数

时间:2013-05-31 14:54:04

标签: asp.net-mvc routes

我希望我的网址如下:

localhost:22504/Apps/App/{name}/{id}/{type}

所以我将路由值添加到Global.asax文件中:

routes.Add("AppRoute", new MyRoute("App/{name}/{id}/{type}", new { controller = "Apps", action = "App" }));
routes.Add("AppRoute2", new MyRoute("App/{id}/{type}", new { controller = "Apps", action = "App" }));

这些路线位于默认路线上方,如下所示:

routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters
    new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

我的控制员:

public ActionResult App(string id, string name, string type)
{
    //code here
}

我的网址。行动:

href="@Url.Action("App", "Apps", new { id = GuidEncoder.Encode(app.AppID), name = "Read more", type = "review"})

Url.Action呈现为:

href="/Apps/App/lBF8BPwVykebNe9XU1KOOg?name=21webmerce-manager1"

我错过了什么?

0 个答案:

没有答案