Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要路由这个:domain.com/blog/2012/12/05/my-friendly-url
到我的博客控制器。我敢肯定这很容易,但我遇到了真正的问题。
我该怎么做?
像这样的东西?
routes.MapRoute( "Blog-Post", "blog/{year}/{month}/{day}/{title}", new { controller = "Blog", action = "View" }, new { year = @"\d{4}", month = @"\d{2}", day = @"\d{2}" } );
那么行动将是
public ActionResult View(int year, int month, int day, string title) {