how to deny user to access sub folders and file?

前端 未结 2 764
盖世英雄少女心
盖世英雄少女心 2020-12-18 19:57

on local machine ,i created sample project on mvc4 (razor) and create directory named \"x\" and put a text file \"a.txt\" in it.

http://localhost:64471/x/a.t         


        
2条回答
  •  别那么骄傲
    2020-12-18 20:27

    I know this is an old question, but if you are having issues and dealing with text or html files, you might want to refer to this stackoverflow question.

    In short, you might need to add this to your web.config:

    
        
            
            
        
    
    

    As kirk points out, files such as .txt and .html files are handled by IIS and not ASP.NET, so the authorization rules aren't applied to them.

提交回复
热议问题