By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,711 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,711 IT Pros & Developers. It's quick & easy.

Trouble creating new directory

P: n/a
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
sh******@hotmail.com

Nov 17 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a

This may be a misnomer of an error, but I think the root of your problem (no
pun intended) is that you don't have permissions to get at data outside of
your configured directory on the Host server. Imagine if you could - you can
probe the entire server and scavage all the other site's files which would
be a bit of a security risk to say the least.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"Sheldon Cohen" <sh******@hotmail.com> wrote in message
news:2d*****************************@phx.gbl...
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
sh******@hotmail.com

Nov 17 '05 #2

P: n/a
Thanks, that makes sense. I have contacted my host and they do not have
a clue what to do. Any suggestions of how I could get this working?

Thanks,

Sheldon Cohen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #3

P: n/a
Thanks, that makes sense. I have contacted my host and they do not have
a clue what to do. Any suggestions of how I could get this working?

Thanks,

Sheldon Cohen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #4

P: n/a
What do you need access to the root for?

Basically your domain probably runs under a specific user account they've
set up for you. That username needs rights to access the directories you
want to access. Since htey lock it down they should have a clue what to do
<g>...

+++ Rick --

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"Sheldon Cohen" <sh******@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP11.phx.gbl...
Thanks, that makes sense. I have contacted my host and they do not have
a clue what to do. Any suggestions of how I could get this working?

Thanks,

Sheldon Cohen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #5

P: n/a
What do you need access to the root for?

Basically your domain probably runs under a specific user account they've
set up for you. That username needs rights to access the directories you
want to access. Since htey lock it down they should have a clue what to do
<g>...

+++ Rick --

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"Sheldon Cohen" <sh******@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP11.phx.gbl...
Thanks, that makes sense. I have contacted my host and they do not have
a clue what to do. Any suggestions of how I could get this working?

Thanks,

Sheldon Cohen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #6

P: n/a
Hi, thanks for responding back to my message.

I don't need root access I think, I am just trying to create a new
directory for each new user that matches a username they choose while
signing up from our website. We create a new jad file which is for their
java enabled cell phone. We are able to create the file using
StreamWriter and File.Create(), only the directory is giving us trouble.

The hosting company is not sure when we called them, they said they were
researching it. I have tried to use the
\\SERVER\OURUSERACCOUNTNAME\DIRECTORY but that gives us the message:
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)

We are really not sure what to do next. Seems like the
d:\inetput\wwwroot\OURUSERACCOUNTNAME\wwwRoot\jads which works when we
use the File.Create(PATH) does not work here.

Thanks for all the help so far, any more would be great.

Sheldon Cohen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #7

P: n/a
Hi, thanks for responding back to my message.

I don't need root access I think, I am just trying to create a new
directory for each new user that matches a username they choose while
signing up from our website. We create a new jad file which is for their
java enabled cell phone. We are able to create the file using
StreamWriter and File.Create(), only the directory is giving us trouble.

The hosting company is not sure when we called them, they said they were
researching it. I have tried to use the
\\SERVER\OURUSERACCOUNTNAME\DIRECTORY but that gives us the message:
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)

We are really not sure what to do next. Seems like the
d:\inetput\wwwroot\OURUSERACCOUNTNAME\wwwRoot\jads which works when we
use the File.Create(PATH) does not work here.

Thanks for all the help so far, any more would be great.

Sheldon Cohen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 17 '05 #8

P: n/a
I think the problem may be share permissions. I had this problem once myself
where the root directory required directory read access or else shares
weren't accessible. I can't remember the details now exactly, but ultimately
it ended up being that I added EveryOne with directory read rights on the
root dir...

Bummer that htis is at an ISP which will make experimenting and trying to
find this issue a lot more work than if you can try it yourself <g>
+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"Sheldon Cohen" <sh******@hotmail.com> wrote in message
news:ez**************@TK2MSFTNGP09.phx.gbl...
Hi, thanks for responding back to my message.

I don't need root access I think, I am just trying to create a new
directory for each new user that matches a username they choose while
signing up from our website. We create a new jad file which is for their
java enabled cell phone. We are able to create the file using
StreamWriter and File.Create(), only the directory is giving us trouble.

The hosting company is not sure when we called them, they said they were
researching it. I have tried to use the
\\SERVER\OURUSERACCOUNTNAME\DIRECTORY but that gives us the message:
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)

We are really not sure what to do next. Seems like the
d:\inetput\wwwroot\OURUSERACCOUNTNAME\wwwRoot\jads which works when we
use the File.Create(PATH) does not work here.

Thanks for all the help so far, any more would be great.

Sheldon Cohen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #9

P: n/a
I think the problem may be share permissions. I had this problem once myself
where the root directory required directory read access or else shares
weren't accessible. I can't remember the details now exactly, but ultimately
it ended up being that I added EveryOne with directory read rights on the
root dir...

Bummer that htis is at an ISP which will make experimenting and trying to
find this issue a lot more work than if you can try it yourself <g>
+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/wwHelp
----------------------------------
Making waves on the Web
"Sheldon Cohen" <sh******@hotmail.com> wrote in message
news:ez**************@TK2MSFTNGP09.phx.gbl...
Hi, thanks for responding back to my message.

I don't need root access I think, I am just trying to create a new
directory for each new user that matches a username they choose while
signing up from our website. We create a new jad file which is for their
java enabled cell phone. We are able to create the file using
StreamWriter and File.Create(), only the directory is giving us trouble.

The hosting company is not sure when we called them, they said they were
researching it. I have tried to use the
\\SERVER\OURUSERACCOUNTNAME\DIRECTORY but that gives us the message:
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)

We are really not sure what to do next. Seems like the
d:\inetput\wwwroot\OURUSERACCOUNTNAME\wwwRoot\jads which works when we
use the File.Create(PATH) does not work here.

Thanks for all the help so far, any more would be great.

Sheldon Cohen

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 17 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.