I would like to create a password protected directory on the remote webserver and have my webapp access that folder as a ‘user’ and be able to read and write. I assume I need a method that can include a username/password for that specific directory?
Is there a recommended way to do that?
I have looked at the ‘DirectoryInfo
’ and ‘FileInfo
’ methods, but I cannot find anything on this subject. I have looked at several threads about WnetAddConnection2
, but I cannot make heads or tails out of these suggestions, as they focus on creating a Share in Windows, more than just allowing access. I am looking for something in near code as:
saveFile (name=xyz) to directoryPath(name, accessCredentials)
I run my ASP.NET Core 2.2 Web Application on a externally hosted environment. One of the features of the app is to upload documents to a directory (folder).
The current setup of my hosting provider allows anonymous to access those documents through a browser (e.g. (www.mydomain.com/securedocs/thisdoc.txt). The hostingprovider does allow for a password-protected directory. I have created such a directory.
EDIT: The directories are located under HttpDocs/wwwroot/ on a webserver, hosted by an external hostingprovider.