【发布时间】:2013-07-04 20:48:21
【问题描述】:
用于 asp.net MVC4 的 URL 重写代码;我用 App_Start/RouteConfig.cs 中的代码下来。
routes.MapRoute(
name: "subjectSefLink",
url: "{controller}/{seo}/{page}",
defaults: new
{
controller = "subject",
action = "Index",
seo = UrlParameter.Optional,
page = UrlParameter.Optional
});
我使用控制器;
public class SubjectController : Controller
{
public ActionResult Index(string seo, int page)
{
return View();
}
}
但不起作用;代码的输出 = 404 not found
【问题讨论】:
标签: asp.net-mvc url url-rewriting asp.net-mvc-routing