ASP.NET MVC 2 - How to ignore an entire directory using IgnoreRoute?

℡╲_俬逩灬. 提交于 2019-12-03 16:29:49

问题


I've tried the following two methods to try and ignore my "Assets" folder, but I keep coming up with errors. Can anyone tell me exactly how the Ignore Regex is supposed to look?

    routes.IgnoreRoute("/Assets/")
    routes.IgnoreRoute("{*assets}", New With {.assets = "\/Assets\/(.*)"})

回答1:


Try

routes.RouteExistingFiles = false
routes.IgnoreRoute("Assets/{*pathInfo}")



回答2:


routes.IgnoreRoute("Ignore/");

will prevent the standard

The controller for path '/Crap/Home' was not found or does not implement IController. Asp.net mvc exception.



来源:https://stackoverflow.com/questions/3251830/asp-net-mvc-2-how-to-ignore-an-entire-directory-using-ignoreroute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!