473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
1 3002
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ricco DeCicco | last post by:
Hi All I have just reinstalled VStudio.Net (VB.Net) and the .Net Framewor and I can successfully open an existing project for editin 'UserControlSample' When I try to create a new project...
3
by: dave | last post by:
I am using vs.net 2003 on windows xp. After clicking on a project within my solution and selecting create new folder vs.net responds back with , the "directory already exists". If i look at the...
6
by: Ferrari, Eduardo | last post by:
Hi all! I'm trying to create this XML file: <?xml version="1.0" encoding="utf-8" ?> <Build type="Daily" sync="True" compile="True" assemble="True" > <Sync version="1.0.0.0" branch="QA">...
6
by: Eran Kampf | last post by:
I am trying to dynamically create directories in my ASP.NET application (I am using Server.MapPath("/")+"test" as the folder) and I am getting a DirectoryNotFoundException saying "Could not find a...
3
by: Stelrad Doulton | last post by:
Hi, I am having a strange problem on IIS 6.0. I am trying to create directories under a virtual directory on the fly to which I will upload files and retrieve these files later. I am having 2...
2
by: Lucky | last post by:
Hello Guys, after long long time. i'm back again with some questions. right now i'm developing a code that fetch the list of websites from IIS 5.0 or later and also cretes the Virtual Directory...
6
by: Charlie Bear | last post by:
i'm really stuck with this one can anyone help! i have a website that uses c#. it creates a series of directories and files from an xml source. when the xml changes, the directory that the...
3
by: veaux | last post by:
Adobe has WAY to many forums and I wasn't sure which was correct so thought I'd try here first. I'm trying to see if there is a product that will allow us to create a large (1,100 pg) directory,...
0
by: david wright | last post by:
--- On Fri, 9/5/08, srinivasan srinivas <sri_annauni@yahoo.co.inwrote: this appears to be working, what where you expecting? "An upper case "S" means there is no executable permission, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.