Security – How to stop users directly accessing files on a website in IIS 7

iisSecurity

I have a website where users upload files through a CMS.

eg http://www.mysite.com/uploadedfiles/file1.txt

I want to stop users on the internet being able to enter this URL into a browser and access these files directly.
How can I do this?

I still need to allow IIS to read, modify and delete these files through the CMS though.

enter image description here

Best Answer

I would recommend either saving the files to a non-web-accessible directory, or creating a random name before saving to disk.