Problem with System.IO.Directory.CreateDirectory in ASP.NET application.

  • Thread starter Thread starter Eran Kampf
  • Start date Start date
E

Eran Kampf

I am trying to dynamically create directories in my ASP.NET application (I
am using Server.MapPath("/")+"test" as the folder)
and I am getting a DirectoryNotFoundException saying "Could not find a part
of the path "D:\".
My site is hosted on a public ISP that for obvious security reasons does not
allow my read access above my wwwroot folder which seems to be a problem
when trying to create directories...

Is there any way to solve this?
 
Eran,

ASP.NET usually runs under account that doesn't have file writing rights at
all. Speak to your ISP.

Eliyahu
 
The ASP.NET worker process user has file writing capabilities under my
specific folder (it can create\modify files in existing directories).
The problem is when trying to create a new directory....
 
So why do I get a wierd "Could not find a part of the path "D:\" exception
instead of a security exception (unauthorized access or something) ?
 
Have you tried just writing out the string you are generating
from Server.MapPath("/") + "test" ?
What have you got there?
 
Yes, you get all sort of wierd exceptions when you run into security
problems. You are right about writting into existing folders, but I am not
sure if creating directories is the same permission as writting files.

Eliyahu
 
Yes I tried that.
Same error

I even tried using DirectoryInfo to get to the wwwroot dir and then creating
a subdirectory and got the same exception...
 
Back
Top