1
我的路线是这样的:控制器不拾取路径
routes.Add(new Route("{companyName}/{action}/{id}", new MvcRouteHandler())
{
Defaults = new RouteValueDictionary(new { controller = "CompanyController", action = "Index", id = 1 }),
}
);
我的行动:
public ActionResult Index(string companyName, string id)
{
Response.Write(companyName);
Response.End();
return ViePage("~/views/company/index.aspx");
}
您也不必指定视图页面的实际文件路径。 MVC框架将找到与View/{Controller}/{Action}匹配的视图 – scottm 2009-09-10 20:03:53
Good Point Scott!也。 ViePage不会走得太远。但这可能只是一个错误:) – Patricia 2009-09-10 20:08:14
啊,添加控制器到最后,谢谢Patricia! – mrblah 2009-09-10 20:09:30