I was trying to Create a Directory using this code:
Directory.CreateDirectory("localhost/attachments/7075");
But it returned 'Access to the path 'localhost/attachments/7075' is denied.'
Please take note that the attachments
is from a Network Shared Folder. I added it using the Add Virtual Directory
on IIS.
What I did is:
IIS_IUsers
and it is in Full Control
You need to use Server.MapPath()
to use the physical file path that corresponds to the virtual path.
Directory.CreateDirectory(Path.Combine(Server.MapPath("~/attachments"), "7075"));