获取MVC忽略到网站根目录路径 [英] Getting MVC to ignore route to site root
本文介绍了获取MVC忽略到网站根目录路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我工作的一个网站,是局部静态内容和部分MVC。该网站的根是index.html,然后我都忽略了明确传送控制器和所有的HTML文件。但是,当你点击网站的根,它试图将其路由。我怎么能告诉路线引擎忽略站点的根目录? www.mysite.com不应路由,而是去的index.html。这里是我的路由配置:
routes.IgnoreRoute({}资源个.axd / {*} PATHINFO);
routes.IgnoreRoute(* HTML | JS | CSS | GIF | JPG | JPEG | PNG | SWF); routes.MapRoute(
vendor_signup,{}供应商/注册/ {}行动/,
新{控制器=注册,行动=索引,供应商= UrlParameter.Optional} //参数默认
);
routes.MapRoute(
注册,注册/ {}行动/,
新{控制器=注册,行动=索引,供应商= Vendors.PCICentral} //参数默认
);
//下面多条航线
解决方案
一个路由的还在{}这使得它尝试解析根。
I'm working on a site that is partially static content and partially MVC. The root of the site is index.html and I have all of the controllers explicitly routed and all html files ignored. However, when you hit the root of the website, it tries to route it. How can I tell the route engine to ignore the root of the site? www.mysite.com should not be routed, but instead go to index.html. Here is my routing configuration:
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
解决方案
One of the routes was still in {} which made it try to parse the root.
这篇关于获取MVC忽略到网站根目录路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文