开发者

asp mvc 2 route all requests to files in specific folder to given controller/action

开发者 https://www.devze.com 2023-02-21 20:41 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消