【发布时间】:2015-05-10 08:53:19
【问题描述】:
我正在尝试创建这条路线:
http://localhost:28790/Admin/Reporting/Reporting?reportName=MyReportName
为了访问这个控制器:
public ActionResult Reporting(string reportName){...}
为此,我在该区域添加了此路由:
context.MapRoute(
"Admin_Reporting",
"Admin/Reporting/Reporting/{reportName}",
new
{
reportName = UrlParameter.Optional
}
);
我已经测试了这个 ActionLink
@Html.ActionLink(My Link, "Reporting", "Reporting", new { area = "Admin", reportName = "reportingName" })
但结果确实不是我所期望的:
http://localhost:28790/Admin/Reporting/Reporting?Length=9
我该怎么做才能让正确的 URL(文章的第一个 URL)插入这个错误的 URL(文章的最新 URL)?
提前感谢您的帮助
【问题讨论】:
-
您使用了错误的重载。必须是
@Html.ActionLink(My Link, "Reporting", "Reporting", new { area = "Admin", reportName = "reportingName" }, null)(null是html属性) -
Arghhh 我知道我忘记了什么!谢啦!把它放在答案中,我会验证它!
标签: asp.net asp.net-mvc asp.net-mvc-4 asp.net-mvc-routing