我正在處理部分靜態內容和部分MVC的網站。該網站的根目錄是index.html,我將所有控制器明確路由並忽略所有html文件。但是,當您點擊網站的根目錄時,它會嘗試將其路由。我如何告訴路由引擎忽略網站的根目錄? www.mysite.com不應該路由,而是去index.html。這裏是我的路由配置:獲取MVC忽略路由到網站根目錄
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.IgnoreRoute("*.html|js|css|gif|jpg|jpeg|png|swf");
routes.MapRoute(
"vendor_signup","{vendor}/signup/{action}/",
new { controller = "Signup", action = "Index", vendor=UrlParameter.Optional} // Parameter defaults
);
routes.MapRoute(
"signup","signup/{action}/",
new { controller = "Signup", action = "Index", vendor=Vendors.PCICentral} // Parameter defaults
);
//more routes below
嗨,是你上面的代碼正確利用這最後的想法? – JasonMenny 2011-09-29 14:06:33