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.
我有一个 url Review.aspx?reviewId=3,我想将此 url 路由到 MVC 控制器/操作 Review/3。有任何想法吗?
没关系,像这样的简单路线有效:
routes.MapRoute( "Reviews_Old", // Route name "LOreview.aspx", // URL with parameters new { controller = "LOReview", action = "Review", id = UrlParameter.Optional } // Parameter defaults );
并且查询字符串参数是模型绑定在控制器动作参数上