Search code examples
asp.netsecurityiiscustom-pages

How can i restrict access to the files of my website?


How can i prevent users from getting the list of files that exist in my website?

For example when users type on the address bar the WebsiteAddress+/DirectoryToSearch/ they get the list of files in that directory, without getting any permission denied error

Is there any setting in asp.net that am i missing?


Solution

  • You should disable directory browsing in IIS.

    For IIS7: http://technet.microsoft.com/en-us/library/cc731109%28WS.10%29.aspx

    For IIS6: Open the web site's properties in IIS Manager, and under the tab "Home Directory", uncheck the checkbox labeled "Directory Browsing".