【发布时间】:2012-09-20 01:44:08
【问题描述】:
我在面向公众的网页的控制器中有以下设置
Company -> About -> Partners(我希望以 Company/About/Partners 的身份访问)
动作方法
public about(string category)
{
ViewBag.Category = category;
return View();
}
链接的生成如下所示,这给了我错误的 URL
@Html.ActionLink("Partners & Investors", "About", "Company",new { Category = "Partners" },null)
错误的网址
Company/About?Category=Partners%20and%20Investors
所以问题是如何生成我想要的正确 url。我该怎么办?
【问题讨论】:
-
@AndrewBarber 嗨,安德鲁我想要一个 url
Company/About/category但它会生成Company/About?category=value你能提供一些输入吗
标签: asp.net-mvc url asp.net-mvc-4 asp.net-mvc-routing actionlink