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