Directory creation

  • Thread starter Thread starter Sparky
  • Start date Start date
S

Sparky

I want to create a directory on my web server from within code. I've tried
using Request.PhysicalApplicationPath() to get the location of the
application, and appended my new directory on the end and used
Directory.CreateDirectory which fails with:

System.IO.DirectoryNotFoundException: Could not find a part of the path
"d:\". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at
System.IO.Directory.InternalCreateDirectory(String fullPath, String path) at
System.IO.Directory.CreateDirectory(String path) at ...

BUT if I manually create the directory in an FTP program, and use
Directory.Exists, it manages to find the directory... the problem just
appears to be creating.

Any clues?

Cheers

Sparky
 
It's probably a security issue. By default ASP.NET runs under the ASPNET
user account. This account does not have a lot of permissions on your
machine. Simply grant it full read, write & create permissions to the path
you're specifying on your server.
 
Back
Top