asp mvc 2 route all requests to files in specific folder to given controller/action
Can't make this work fast. I have a folder in whic开发者_如何学编程h I have text files. And so if user requests some file like mysite.com/thefolder/file.txt he sees the contents of the file. What route should I register so that all requests to anything in the folder would go to mysite.com/Error/NotAllowed action?
IIS will, by default, serve all .txt files directly without even going to the ASP.NET handler, which handles routing and MVC.
To change that behaviour, you will have to change your IIS settings or change the routing rules at any firewall/load balancer you have in front of it.
精彩评论