473,765 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Creating Directory

Hello,

The following error is appearing when attempting to create a directory
using the availale system.io methods:

System.IO.Direc toryNotFoundExc eption: Could not find a part of the
path "D:\". at System.IO.__Err or.WinIOError(I nt32 errorCode, String
str) at System.IO.Direc tory.InternalCr eateDirectory(S tring fullPath,
String path) at System.IO.Direc tory.CreateDire ctory(String path) at
TestVBProject.c reatedirectoryt est.Page_Load(O bject sender, EventArgs
e)

The code works fine in my test environment (wide open permissions) but
fails on the production server at the hosting facility. We have tried
giving full permissions to the aspnet account and it still fails.
Windows 2003 is used on the production server.

Because there are shared users on the server, I am afraid to try
changing the user in machine.config to SYSTEM, but if that should be
attempted, let me know.

Any help on the matter is appreciated.

Thanks.
Nov 18 '05 #1
3 2293
Hi,

If you are using Windows 2003, then its not the ASPNet account who is
actually executing the thread that is trying to create the folder. Its the
user account that is running the application pool bound to the IIS
application. This has changed from Windows 2000. Look in the properties of
the application pool, identity tab.

Also, if you want to confirm this, use the following in one of your .aspx
pages to see who its running as.

//sample
Response.Write( "Current executing thread is " +
System.Security .Principal.Wind owsIdentity.Get Current().Name) ;

Michael

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"James Coleman" <ja************ *@gmail.com> wrote in message
news:d1******** *************** ***@posting.goo gle.com...
Hello,

The following error is appearing when attempting to create a directory
using the availale system.io methods:

System.IO.Direc toryNotFoundExc eption: Could not find a part of the
path "D:\". at System.IO.__Err or.WinIOError(I nt32 errorCode, String
str) at System.IO.Direc tory.InternalCr eateDirectory(S tring fullPath,
String path) at System.IO.Direc tory.CreateDire ctory(String path) at
TestVBProject.c reatedirectoryt est.Page_Load(O bject sender, EventArgs
e)

The code works fine in my test environment (wide open permissions) but
fails on the production server at the hosting facility. We have tried
giving full permissions to the aspnet account and it still fails.
Windows 2003 is used on the production server.

Because there are shared users on the server, I am afraid to try
changing the user in machine.config to SYSTEM, but if that should be
attempted, let me know.

Any help on the matter is appreciated.

Thanks.

Nov 18 '05 #2
Thanks for the reply. I had already checked out the account and found
that it wasn't the aspnet account, but giving the correct account full
permissions to the directory didn't solve the problem.

The solution to the problem was to give the calling account
permissions to the root directory, not just the root of the website.
The hosting facility, however, is not willing to grant me these
permissions, so I'm in a pickle.

I've tried running batch files and or calling the command line via
system.diagnost ics.process, but it doesn't work either.

The hosting facility claimed it was a bug with Win2003. I don't know.
All I want to do is create a directory! I'm not that experience with
com, but wonder if I need to create an unmanaged com object to do it
and then call that in .net.

How can I get around needing access to the root? Apparently one
company was able to solve it:
http://support.mathsoft.com/mas/article.asp?id=893

I don't know how they did it however.

Thanks,

James
"Michael O'Donovan [MSFT]" <mi******@onlin e.microsoft.com > wrote in message news:<eN******* *******@TK2MSFT NGP11.phx.gbl>. ..
Hi,

If you are using Windows 2003, then its not the ASPNet account who is
actually executing the thread that is trying to create the folder. Its the
user account that is running the application pool bound to the IIS
application. This has changed from Windows 2000. Look in the properties of
the application pool, identity tab.

Also, if you want to confirm this, use the following in one of your .aspx
pages to see who its running as.

//sample
Response.Write( "Current executing thread is " +
System.Security .Principal.Wind owsIdentity.Get Current().Name) ;

Michael

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"James Coleman" <ja************ *@gmail.com> wrote in message
news:d1******** *************** ***@posting.goo gle.com...
Hello,

The following error is appearing when attempting to create a directory
using the availale system.io methods:

System.IO.Direc toryNotFoundExc eption: Could not find a part of the
path "D:\". at System.IO.__Err or.WinIOError(I nt32 errorCode, String
str) at System.IO.Direc tory.InternalCr eateDirectory(S tring fullPath,
String path) at System.IO.Direc tory.CreateDire ctory(String path) at
TestVBProject.c reatedirectoryt est.Page_Load(O bject sender, EventArgs
e)

The code works fine in my test environment (wide open permissions) but
fails on the production server at the hosting facility. We have tried
giving full permissions to the aspnet account and it still fails.
Windows 2003 is used on the production server.

Because there are shared users on the server, I am afraid to try
changing the user in machine.config to SYSTEM, but if that should be
attempted, let me know.

Any help on the matter is appreciated.

Thanks.

Nov 18 '05 #3
This is a relatively known .NET bug or "feature".. .



Both Directory.Creat eDirectory(path ) and DirectoryInfo.C reateSubdirecto ry(path) require user to have Read access to the drive's root directory (i.e. <Drive>:\).



Many ASP.NET hosting providers (especially those running Windows 2003 Server) will not allow user running ASP.NET worker process read access to the root folder, so CreateDirectory will always fail. You can not blame hosting providers - they do right thing, securing shared environment from users with malicious intents.



The only workaround I have found is to replace call to Directory.Creat eDirectory() with call to unmanaged code, like msvcrt's _mkdir(char*):



[DllImport("msvc rt.dll", SetLastError=tr ue)]

static extern int _mkdir(string path);



....

//replace call to Directory.Creat eDirectory with:

_mkdir(newDirec tory);

....



This will work only if your code is granted "Allow Calls to Unmanaged Code" permission but most hosting environments allow that.



You can find more details in my recent Blog entry at http://hatka.net/wlogdev/archive/2004/08/29/178.aspx



Dmitry Kulakovsky

"James Coleman" <ja************ *@gmail.com> wrote in message news:d1******** *************** ***@posting.goo gle.com...
Thanks for the reply. I had already checked out the account and found
that it wasn't the aspnet account, but giving the correct account full
permissions to the directory didn't solve the problem.

The solution to the problem was to give the calling account
permissions to the root directory, not just the root of the website.
The hosting facility, however, is not willing to grant me these
permissions, so I'm in a pickle.

I've tried running batch files and or calling the command line via
system.diagnost ics.process, but it doesn't work either.

The hosting facility claimed it was a bug with Win2003. I don't know.
All I want to do is create a directory! I'm not that experience with
com, but wonder if I need to create an unmanaged com object to do it
and then call that in .net.

How can I get around needing access to the root? Apparently one
company was able to solve it:
http://support.mathsoft.com/mas/article.asp?id=893

I don't know how they did it however.

Thanks,

James


"Michael O'Donovan [MSFT]" <mi******@onlin e.microsoft.com > wrote in message news:<eN******* *******@TK2MSFT NGP11.phx.gbl>. ..
Hi,

If you are using Windows 2003, then its not the ASPNet account who is
actually executing the thread that is trying to create the folder. Its the
user account that is running the application pool bound to the IIS
application. This has changed from Windows 2000. Look in the properties of
the application pool, identity tab.

Also, if you want to confirm this, use the following in one of your ..aspx
pages to see who its running as.

//sample
Response.Write( "Current executing thread is " +
System.Security .Principal.Wind owsIdentity.Get Current().Name) ;

Michael

--
This posting is provided "AS IS" with no warranties, and confers no rights.
"James Coleman" <ja************ *@gmail.com> wrote in message
news:d1******** *************** ***@posting.goo gle.com...
Hello,

The following error is appearing when attempting to create a directory
using the availale system.io methods:

System.IO.Direc toryNotFoundExc eption: Could not find a part of the
path "D:\". at System.IO.__Err or.WinIOError(I nt32 errorCode, String
str) at System.IO.Direc tory.InternalCr eateDirectory(S tring fullPath,
String path) at System.IO.Direc tory.CreateDire ctory(String path) at
TestVBProject.c reatedirectoryt est.Page_Load(O bject sender, EventArgs
e)

The code works fine in my test environment (wide open permissions) but
fails on the production server at the hosting facility. We have tried
giving full permissions to the aspnet account and it still fails.
Windows 2003 is used on the production server.

Because there are shared users on the server, I am afraid to try
changing the user in machine.config to SYSTEM, but if that should be
attempted, let me know.

Any help on the matter is appreciated.

Thanks.

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2569
by: timothy.williams | last post by:
I'm trying to install wxPython 2.5.3.1 using Python 2.3.2 on a Fedora 2 machine. I have python in a non-standard place, but I'm using --prefix with the configure script to point to where I have everything. The make install in $WXDIR seemed to go fine. I have the libxw* libraries in my lib/ directory libwx_base-2.5.so@ libwx_gtk_adv-2.5.so.3.0.0* libwx_base-2.5.so.3@ libwx_gtk_core-2.5.so@
3
15638
by: Jagdip Singh | last post by:
Hi, We are facing problem accessing to DB2. Seems like database manager is down I tried starting it using db2start but it was neither showing any messages nor returning to command prompt after finishing start. I do not know actually if it was trying to start database or hanging somewhere
4
11719
by: | last post by:
Hi, all: I have a RedHat 9 with gcc version 3.4.1, and I want to compile siph323csgw with ¡§make siph323csgw¡¨. But when I compile siph323csgw, I get this message: configure: creating ./config.status
8
3398
by: nick | last post by:
I have a problem and I've been using a cheezy work around and was wondering if anyone else out there has a better solution. The problem: Let's say I have a web application appA. Locally, I set it up as C:\domains\appA. Locally, my IIS root points to C:\domains. I don't point it to C:\domains\appA since if I have an appB under C:\domains I wouldn't be able to get to it. So to access it via my browser I go to localhost/appA.
5
1277
by: יוני גולדברג | last post by:
Hi, While trying to create new directory i recieve the following error message: "System.IO.DirectoryNotFoundException: Could not find a part of the path "\\premfs16\sites". The path exists, even when i check the path with the code: Directory.Exists(...) the result is true. Here is the code: http://www.adeo.co.il/test.aspx
2
1831
by: Richard Lionheart | last post by:
Hi All, I generated a WebForm and created a Virtual Directory for it IIS. But I got an error message (shown below) saying something like my app lacked appropriate privileges. David Wang replied to an earlier question about this issue, and he informed me that I needed to include my UserID in the "VS Developers" group in order to WebForm apps running under my account capable of accessing \\server\wwwroot$.
1
2054
by: Medora Schauer | last post by:
I've installed 7.4.2 on a PowerPC system running linux 2.4.13. When I try to run initdb to create to create the database cluster I get the following: $ initdb -D $PGDATA The files belonging to this database system will be owned by user "thebox".
2
1934
by: tech tech | last post by:
Hello All, I installed postgresql 7.3.4 on HPUX PA in /usr/local/pgsql and put the libraries in /usr/local/pgsql/lib/LIB_new. During the initialization( initdb), it loads libraries (language) from /usr/local/pgsql/lib. In postgresql version 7.3.1, libraries are not loaded and no such problem during initdb. I had the following problem: $ initdb -D /var/pgsql The files belonging to this database system will be owned by user "postgres".
1
1151
by: John_Baptist | last post by:
Hello, I have created a virtual directory in IIS 6.0 with the name JohnASP . Now my problem is when i'm creating new ASP.NET project in MSVS .NET in the location place which name i should give either Folder Name or Virtual Directory Name ie ( http://Localhost/ < Alias-Name of virtual directory or actual Folder Name (JOHN in D drive) > Thanx in advance
1
1654
by: Richard | last post by:
Hi, I created a new directory on my WinXP-Pro/SP2 file system. Then I created a virtual directory in IIS pointing to that local directory. After completing that, I noticed that I had a mispelling in the name of the parent directory of that local directory. I "improved" the situation by creating a correctly-spelled peer of that parent directory. Then I dragged my new local directory from its misspelled parent to the correctlyl...
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10161
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9833
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7378
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.