ASP.NET MVC 2 IgnoreRoute在所有目录 [英] ASP.NET MVC 2 IgnoreRoute in all directories
问题描述
我从MVC 1切换到MVC 2,我在我的应用程序中使用file.axd的HttpHandler,我设置 routes.IgnoreRoute({}资源个.axd / {*} PATHINFO);
在我的全局路由。由于MVC 2 MVC只是忽略请求 /file.axd
,但不会以 /folder/file.axd。
在MVC 2的任何变化?
我只是想确保任何文件夹中的任何文件的个.axd所有请求都会被我的HttpHandler得到处理。
谢谢!
routes.IgnoreRoute({*} allaxd,新{allaxd = @。* \\。AXD(/ 。*)})?;
感谢HAACKED:<一href=\"http://haacked.com/archive/2008/07/14/make-routing-ignore-requests-for-a-file-extension.aspx\">http://haacked.com/archive/2008/07/14/make-routing-ignore-requests-for-a-file-extension.aspx
I switched from MVC 1 to MVC 2. I am using a file.axd httphandler in my application and I set routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
in my global routing. Since MVC 2 MVC only ignores requests to /file.axd
but not to /folder/file.axd.
Any changes in MVC 2?
I just want to make sure that all requests in any folder to any .axd file will get processed by my httphandler.
Thanks!
routes.IgnoreRoute("{*allaxd}", new { allaxd = @".*\.axd(/.*)?" });
Thanks to HAACKED: http://haacked.com/archive/2008/07/14/make-routing-ignore-requests-for-a-file-extension.aspx
这篇关于ASP.NET MVC 2 IgnoreRoute在所有目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!