Wednesday, March 28, 2012

Trouble creating new directory

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(@dotnet.itags.org.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
shelman2@dotnet.itags.org.hotmail.comThis 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" <shelman2@.hotmail.com> wrote in message
news:2db7501c394e2$8cb6dd20$a601280a@.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
> shelman2@.hotmail.com
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!
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!
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" <shelman2@.hotmail.com> wrote in message
news:uMQNpQSlDHA.3504@.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!
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" <shelman2@.hotmail.com> wrote in message
news:uMQNpQSlDHA.3504@.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!
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!
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!
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" <shelman2@.hotmail.com> wrote in message
news:ezyH6tylDHA.2652@.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!
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" <shelman2@.hotmail.com> wrote in message
news:ezyH6tylDHA.2652@.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!

0 comments:

Post a Comment