S
Sheldon Cohen
Hello,
I am using c# and running a site that is on a shared
host. The code in question is supposed to create a new
directory that is coming out of a text box.
It works fine on my computer, but I get the following
stack trace:
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.DirectoryInfo.Create
() at testapps.createdir.CreateSubDirectory(String direc)
The code to create is as follows:
public bool CreateSubDirectory(string direc)
{
bool returnStatus = false;
DirectoryInfo di = new DirectoryInfo(@direc);
if(di.Exists)
{
Trace.Write("Directory exists " +
di.FullName);
this.Label1.Text = "Directory exists";
}
else
{
Trace.Write("Directory does not exist " +
di.FullName);
this.Label1.Text = "Directory does not
exists";
try
{
di.Create();
if(di.Exists)
{
Trace.Write("Directory exists
after creating it");
this.Label1.Text += "Directory
exists after creating it";
}
}
catch(Exception ex)
{
this.Label1.Text += "Error trying to
create directory that did not exist " + ex.ToString();
Trace.Write("Error creating directory
that does not exist " + ex);
}
}
return returnStatus;
}
Any ideas or suggestions, it works great on my local
machine?
Sheldon Cohen
(e-mail address removed)
I am using c# and running a site that is on a shared
host. The code in question is supposed to create a new
directory that is coming out of a text box.
It works fine on my computer, but I get the following
stack trace:
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.DirectoryInfo.Create
() at testapps.createdir.CreateSubDirectory(String direc)
The code to create is as follows:
public bool CreateSubDirectory(string direc)
{
bool returnStatus = false;
DirectoryInfo di = new DirectoryInfo(@direc);
if(di.Exists)
{
Trace.Write("Directory exists " +
di.FullName);
this.Label1.Text = "Directory exists";
}
else
{
Trace.Write("Directory does not exist " +
di.FullName);
this.Label1.Text = "Directory does not
exists";
try
{
di.Create();
if(di.Exists)
{
Trace.Write("Directory exists
after creating it");
this.Label1.Text += "Directory
exists after creating it";
}
}
catch(Exception ex)
{
this.Label1.Text += "Error trying to
create directory that did not exist " + ex.ToString();
Trace.Write("Error creating directory
that does not exist " + ex);
}
}
return returnStatus;
}
Any ideas or suggestions, it works great on my local
machine?
Sheldon Cohen
(e-mail address removed)