所有目录中的ASP.NET MVC 2 IgnoreRoute

awe*_*wex 4 asp.net-mvc

我从MVC 1切换到MVC 2.我在我的应用程序中使用了file.axd httphandler,并设置routes.IgnoreRoute("{resource}.axd/{*pathInfo}");了我的全局路由.由于MVC 2 MVC只是忽略请求/file.axd,但/folder/file.axd.

MVC 2有什么变化吗?

我只想确保任何文件夹中任何.axd文件的所有请求都将由我的httphandler处理.

谢谢!

小智 5

routes.IgnoreRoute("{*allaxd}", new { allaxd = @".*\.axd(/.*)?" });
Run Code Online (Sandbox Code Playgroud)

感谢HAACKED:http://haacked.com/archive/2008/07/14/make-routing-ignore-requests-for-a-file-extension.aspx