1

I have this upload file structure link localhost:58707/uploads/interaction/5/Chrysanthemum.jpg

I want to deny all the users to access '~/uploads' directly..

So, I put this in my web.config as I see in others questions here:

  <location path="~/uploads"> //I've tried '/upload' and 'upload' too.
    <system.webServer>
      <directoryBrowse enabled="false" />
    </system.webServer>
  </location>

But it doesn't work. How can I do this?

MuriloKunze
  • 15,195
  • 17
  • 54
  • 82
  • 4
    I would suggest saving the uploaded files to a folder outside of your site root. Then you don't need to worry about it being browsable since it isn't even in the site directory. – Gromer Oct 02 '12 at 17:18

2 Answers2

1

This solution is working for my project: Use App_Data

tmorell
  • 549
  • 5
  • 14