467,905 Members | 1,793 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,905 developers. It's quick & easy.

Creating Directories with ASP.NET and C# code

Con is the file name for a reserved device name(i think
it is for console). So you cannot create a file with
name 'con'. choose some other name

senthil

-----Original Message-----
Hi everyone, I am having a problem with creating directories using theDirectory classes static member function CreateDirectory.

Here is the following code that I am trying to run that is causing theproblem.
string patient_path = @"c:\inetpub\wwwroot\EMRWeb\Patient_Files\3040"Directory.CreateDirectory(patient_path);
Directory.CreateDirectory(patient_path + @"\RAD");
Directory.CreateDirectory(patient_path + @"\MISC");
Directory.CreateDirectory(patient_path + @"\LAB");
Directory.CreateDirectory(patient_path + @"\CON");

when the following code runs, the last line always gives the followingerror:
"could not find a part of the path c:\"
The other CreateDirectory calls create the directories properly, so it mustbe something with the name of the path
"c:\inetpub\wwwroot\EMRWeb\Patient_Files\3040\CON "

I have also tried usually the following substitue code to the same thing butit also gives a error when creating the CON subfolder:

DirectoryInfo dir = new DirectoryInfo(patient_path);
dir.Create();
dir.CreateSubdirectory("RAD");
dir.CreateSubdirectory("MISC");
dir.CreateSubdirectory("LAB");
dir.CreateSubdirectory("CON");
I don't think it is a problem with permissions because the other directoriesare created properly, but these are the security and permission settings.The identity of the asp.net application is running under the default ASPNETuser account created by .NET framework. The ASPNET account has fullcontroll access folder "c:\inetpub\wwwroot\EMRWeb\Patient_Files" and thepermissions are inherited for any subfolders.

Any help on this matter would be greatly appreciated

thanks

Babak
.

Nov 17 '05 #1
  • viewed: 2776
Share:
1 Reply
Thanks.. that did the trick.

"Senthil" <to********@hotmail.com> wrote in message
news:06****************************@phx.gbl...
Con is the file name for a reserved device name(i think
it is for console). So you cannot create a file with
name 'con'. choose some other name

senthil

-----Original Message-----
Hi everyone, I am having a problem with creating

directories using the
Directory classes static member function CreateDirectory.

Here is the following code that I am trying to run that

is causing the
problem.
string patient_path =

@"c:\inetpub\wwwroot\EMRWeb\Patient_Files\3040"
Directory.CreateDirectory(patient_path);
Directory.CreateDirectory(patient_path + @"\RAD");
Directory.CreateDirectory(patient_path + @"\MISC");
Directory.CreateDirectory(patient_path + @"\LAB");
Directory.CreateDirectory(patient_path + @"\CON");

when the following code runs, the last line always gives

the following
error:
"could not find a part of the path c:\"
The other CreateDirectory calls create the directories

properly, so it must
be something with the name of the path
"c:\inetpub\wwwroot\EMRWeb\Patient_Files\3040\CON "

I have also tried usually the following substitue code

to the same thing but
it also gives a error when creating the CON subfolder:

DirectoryInfo dir = new DirectoryInfo(patient_path);
dir.Create();
dir.CreateSubdirectory("RAD");
dir.CreateSubdirectory("MISC");
dir.CreateSubdirectory("LAB");
dir.CreateSubdirectory("CON");
I don't think it is a problem with permissions because

the other directories
are created properly, but these are the security and

permission settings.
The identity of the asp.net application is running under

the default ASPNET
user account created by .NET framework. The ASPNET

account has full
controll access

folder "c:\inetpub\wwwroot\EMRWeb\Patient_Files" and the
permissions are inherited for any subfolders.

Any help on this matter would be greatly appreciated

thanks

Babak
.

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ricco DeCicco | last post: by
6 posts views Thread by Ferrari, Eduardo | last post: by
3 posts views Thread by Stelrad Doulton | last post: by
6 posts views Thread by Charlie Bear | last post: by
reply views Thread by david wright | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.