I've just very recently managed to fix a problem with my site that wouldn't let me create directories using System.IO.Directory.CreateDirectory() and System.IO.DirectoryInfo.CreateSubDirectory(). The exception thrown is DirectoryNotFoundException - Could not find a part of the path "D:\"..

Now this only happens on my host, not my local machine and I couldn't work out what the problem was. It turns out that it's a “feature” of .NET and both those methods need ReadOnly access to the root drive, which of course no host is going to give you. I eventually found some sort of a solution to the problem (I can't remember where). Adding the following code (c#) will sort the problem out:

[DllImport("msvcrt.dll", SetLastError=true)]
static extern int _mkdir(string path);

Using the _mkdir() method will create the directory for you. This is unmanaged code and so isn't ideal. But it seems to be the only way unless it has been sorted in .NET 2.

[Update] - Found the source of the solution I found.