【发布时间】:2016-02-14 10:07:03
【问题描述】:
我使用 ASP.NET MVC 开发了一个 Web 应用程序。我的路线有问题。
我需要这样的路线。 http://localhost/content-name/23.html
我为此定义了如下路线
//i need this route but it's not work
routes.MapRoute(
"GetContent",
"{sefLink}/{contentId}.html",
new { controller = "Content", action = "GetContent" },
new[] { "CanEcomm.Controllers" });
但是路线不通。 IIS 向我显示 404 页面。当我删除 .html 扩展名时,该路线有效。
//this route is working. i just remove ".html" extension
routes.MapRoute(
"GetContent",
"{sefLink}/{contentId}",
new { controller = "Content", action = "GetContent" },
new[] { "CanEcomm.Controllers" });
我该如何解决这个问题? 谢谢
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-mvc-4 routes