How to protect a directory in asp.net MVC?
What would be the easiest way to secure a directory in asp.net mvc?
I currently have a folder of files that are owned by numerous users of the site. Ideally, I don't want one user to be able to enter the URL of one of these documents in a browser and be able to access it. These files should only be loaded through a controller action that allows the download by validating the user credentials and then returning the file.
Thanks in Advance
source to share
My solution for them usually is that this directory exists outside of network access. For example, instead of storing them in the c: \ inetpub \ wwwroot \ docs directory, just save them in the C: \ inetpub \ docs folder.
Just make sure your controller reads /? wrote? privilege.
This created a better solution for me when I was adding / removing folders as my host limited my ability to turn off the file monitor. And it turns out that deleting the application subfolder results in reworking> application pool> _ <
source to share