Directory creation

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
 
S

Steve C. Orr, MCSD

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.
 

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

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top