473,414 Members | 1,631 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,414 software developers and data experts.

DirectoryNotFoundException - Could not find a part of the path "D:\".

Creating a subfolder within my ASP.NET application folder fails with the
above error, but only at my hosting provider. The command:
Directory.CreateDirectory(path)

Path is set to 'D:\appfolder\test2'. ASPNET has full control on the
application folder.

Any ideas why this fails?

- Tom

Nov 18 '05 #1
5 7193
Hi,

are you sure your provider has D:/ driver on the host server ?

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #2
Yes. It is confirmed in the documentation of the provider. And I get it from
the AppDomain.CurrentDomain.BaseDir.

Could it be, that ASPNET need browsing rights on the D drive?

- Tom

"Natty Gur" <na***@dao2com.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

are you sure your provider has D:/ driver on the host server ?

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #3
The following code fails with above error message:
parentpath = AppDomain.CurrentDomain.BaseDirectory + "_Portals/";
s = System.IO.Path.Combine(parentpath,"_test");
System.IO.Directory.CreateDirectory(s);

I've debugged the problem at my hosting provider by creating a test page and
using the Directory and DirectoryInfo classes:

Creating Folder "D:/portalapp/public_html/_Portals/_test" failed:
Could not find a part of the path "D:/".

Current Folder C:\WINNT\system32

Drives: A:\C:\D:\Z:\

Parentfolder D:\portalapp\public_html\_Portals exists
Parentfolder D:\portalapp\public_html exists
Parentfolder D:\portalapp exists
Parentfolder D:\ does not exist.
Rootfolder D:\ does not exist.

If anybody has an idea why ASPNET can see the D:\ drive but doesn't seem to
find it when creating a subdirectory, please let me know.

- Tom

"Natty Gur" <na***@dao2com.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

are you sure your provider has D:/ driver on the host server ?

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #4
Tom hi,

I can't get something. You are writing that D driver doesn't exist
"Parentfolder D:\ does not exist Rootfolder D:\ does not exist" and you
expect .Net to create sub directory there? Maybe d:/ is mapping to
remote storage (NAS, SAN). If so ASP.NET defaults user don't have rights
to access remote resources.

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #5
This is a relatively known .NET bug or "feature"...

Both Directory.CreateDirectory(path) and
DirectoryInfo.CreateSubdirectory(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 working 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.CreateDirectory() with call to unmanaged code, like msvcrt's
_mkdir(char*):

[DllImport("msvcrt.dll", SetLastError=true)]

static extern int _mkdir(string path);

....

//replace call to Directory.CreateDirectory with:

_mkdir(newDirectory);

....

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

"Tom Vogel" <tv**@yahoo.com> wrote in message
news:O2*************@TK2MSFTNGP09.phx.gbl...
The following code fails with above error message:
parentpath = AppDomain.CurrentDomain.BaseDirectory + "_Portals/";
s = System.IO.Path.Combine(parentpath,"_test");
System.IO.Directory.CreateDirectory(s);

I've debugged the problem at my hosting provider by creating a test page and using the Directory and DirectoryInfo classes:

Creating Folder "D:/portalapp/public_html/_Portals/_test" failed:
Could not find a part of the path "D:/".

Current Folder C:\WINNT\system32

Drives: A:\C:\D:\Z:\

Parentfolder D:\portalapp\public_html\_Portals exists
Parentfolder D:\portalapp\public_html exists
Parentfolder D:\portalapp exists
Parentfolder D:\ does not exist.
Rootfolder D:\ does not exist.

If anybody has an idea why ASPNET can see the D:\ drive but doesn't seem to find it when creating a subdirectory, please let me know.

- Tom

"Natty Gur" <na***@dao2com.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

are you sure your provider has D:/ driver on the host server ?

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 18 '05 #6

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

Similar topics

0
by: Tom Vogel | last post by:
Creating a subfolder within my ASP.NET application folder fails with the above error, but only at my hosting provider. The command: Directory.CreateDirectory(path) Path is set to...
3
by: Dmitry Jouravlev | last post by:
Hi, I have a number of C++ solutions in Visual Studio .NET and when i compile them using "Whole Program Optimization", certain projects report a LNK1171 error saying that c2.dll could not be...
0
by: Martin | last post by:
Is this a known problem? Server Error in '/' Application. Could not find a part of the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET...
0
by: dsh | last post by:
I have an ASP.NET web application running on a load-balanced Windows Server 2003 web farm running IIS 6.0, using Active Directory authentication. I'm trying to programmatically create a new...
1
by: Michiel Schaeverbeke | last post by:
Hi, I'm trying to reach an xml file from within a web application. The file is physically on a different server. When I try to reach it using \\servername\path\ style, I get the error...
0
by: haylow | last post by:
Hi I am new to ASP.NET and am working on an application that runs on a webserver. The user will open up the web interface in a browser on their local machine and enter a path to a directory. I...
9
by: Clinton Frankland | last post by:
Hi, On a Windows 2000 Server when attempting to use System.IO.Directory.CreateDirectory(string.concat(Server.MapPath(""), "\verify")) I receive a System.IO.DirectoryNotFoundException error:...
2
by: Guoqi Zheng | last post by:
Dear sir, I am trying to save a binary data by below script, however,it always give me an error of "Could not find a part of the path "C:\temp\". " Any idea what I did wrong here? ...
3
by: Nitinkcv | last post by:
Hi, While trying to run my app im getting the error Could not find a part of the path "c:\inetpub\wwwroot\Do not Delete\dbglobal.config". I checked and found that there is no Important_Do not...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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:
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,...
0
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...

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.