How to upload files to IIS Virtual Directory?

2019-07-27 10:23发布

问题:

I'm writing a .NET application that needs to upload files. I have presentation, service and data layers. Files get submitted in the Presentation layer (MVC), and then saved by the Data layer. Currently I'm saving files to the file system - C:\SomeDirectory, but I need to save them within the virtual directory in IIS which is managed by Plesk. Did anybody come across any resources explaining how to save files to the virtual directory in IIS?

Should I be uploading files to virtual directory at all?

Thank you!

回答1:

There isn't anything wrong with saving to a virtual directory as such, but it isn't really meant for that. The best way of saving is to try to get the absolute path of the virtual directory (if outside your site root) if at all possible.



标签: c# .net iis plesk