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

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?
 
E

Eliyahu Goldin

Eran,

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

Eliyahu
 
E

Eran Kampf

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....
 
E

Eran Kampf

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) ?
 
D

Dennis Myrén

Have you tried just writing out the string you are generating
from Server.MapPath("/") + "test" ?
What have you got there?
 
E

Eliyahu Goldin

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
 
E

Eran Kampf

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top