开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜