I have a c#.net application that allows users to upload documents. The documents are then scanned for malware and saved. These documents are saved in a share file and in an uploads folder. The share file is on the intranet on a separate server. The uploads folder sits in the same directory as the application, but is not part of the application. The host server is running iis 7 with directory listing off.
The issue is that if an outside user is able to guess the naming convention and the file name, they can type that into a browser and view the document.
The application runs under a user account. We have tried setting the permissions on the uploads folder to only allow the applications user account access, which did not work.
I also tried adding a web config to the folder:
<?xml version="1.0"?>
<configuration>
<system.web>
<authorization>
<allow users="application_user_account" />
<deny users="?" />
</authorization>
</system.web>
</configuration>
This did not work when placed inside the uploads folder, but when it was accidentally placed in a folder one level up, the server denied all users access to all the applications hosted in the environment.
Does anyone have a solution for preventing direct access to the uploads folder in this scenario?