473,395 Members | 2,006 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,395 software developers and data experts.

System.IO.DirectoryNotFoundException: Could not find a part of the path

I'm trying to create a directory on the web server with a
vb.net code:
....

Dim dirName As String = "w:\filepath\images"

If Not Directory.Exists(dirName) Then
Directory.CreateDirectory(dirName)
Label1.Text = "Directory created"
Else
Label1.Text = "Directory exists"
End If

....

And I'm getting an exception:
Could not find a part of the path "w:\".

Exception Details: System.IO.DirectoryNotFoundException:
Could not find a part of the path "w:\".

When I run it with "w:\filepath\" it says "Directory
exists". Only when I want to create a new directory the
exception occurs. The ASP.NET user has all rights on that
drive, and there would be another exception
like ... "access to path denied".

Does anyone knows what is going on here and what does it
mean "could not find a part of the path"?

I can run this code locally and it works fine, the problem
is only at my webservers host computer.

Regards
Matthias

ps here the full exception:
Could not find a part of the path "w:\".
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException:
Could not find a part of the path "w:\".

Source Error:

An unhandled exception was generated during the execution
of the current web request. Information regarding the
origin and location of the exception can be identified
using the exception stack trace below.

Stack Trace:
[DirectoryNotFoundException: Could not find a part of the
path "w:\".]
System.IO.__Error.WinIOError(Int32 errorCode, String
str) +287
System.IO.Directory.InternalCreateDirectory(String
fullPath, String path) +489
System.IO.Directory.CreateDirectory(String path) +195
config.test.Button1_Click(Object sender, EventArgs e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
+108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEve
ntHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String
eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277


-----------------------------------------------------------
---------------------
Version Information: Microsoft .NET Framework
Version:1.1.4322.573; ASP.NET Version:1.1.4322.573


Jul 21 '05 #1
1 53392
Problem solved: In the security for the w: directory, the
ASP.NET user needs Read permission.

-----Original Message-----
I'm trying to create a directory on the web server with avb.net code:
....

Dim dirName As String = "w:\filepath\images"

If Not Directory.Exists(dirName) Then
Directory.CreateDirectory(dirName)
Label1.Text = "Directory created"
Else
Label1.Text = "Directory exists"
End If

....

And I'm getting an exception:
Could not find a part of the path "w:\".

Exception Details: System.IO.DirectoryNotFoundException:
Could not find a part of the path "w:\".

When I run it with "w:\filepath\" it says "Directory
exists". Only when I want to create a new directory the
exception occurs. The ASP.NET user has all rights on that
drive, and there would be another exception
like ... "access to path denied".

Does anyone knows what is going on here and what does it
mean "could not find a part of the path"?

I can run this code locally and it works fine, the problemis only at my webservers host computer.

Regards
Matthias

ps here the full exception:
Could not find a part of the path "w:\".
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and whereit originated in the code.

Exception Details: System.IO.DirectoryNotFoundException:
Could not find a part of the path "w:\".

Source Error:

An unhandled exception was generated during the execution
of the current web request. Information regarding the
origin and location of the exception can be identified
using the exception stack trace below.

Stack Trace:
[DirectoryNotFoundException: Could not find a part of the
path "w:\".]
System.IO.__Error.WinIOError(Int32 errorCode, String
str) +287
System.IO.Directory.InternalCreateDirectory(String
fullPath, String path) +489
System.IO.Directory.CreateDirectory(String path) +195
config.test.Button1_Click(Object sender, EventArgs e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
+108

System.Web.UI.WebControls.Button.System.Web.UI.IP ostBackEv entHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent
(IPostBackEventHandler sourceControl, String
eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent
(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277


---------------------------------------------------------- ----------------------
Version Information: Microsoft .NET Framework
Version:1.1.4322.573; ASP.NET Version:1.1.4322.573


.

Jul 21 '05 #2

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...
4
by: Frederico Caldeira Knabben | last post by:
Hello, I'm having a problem when trying to use the Directory.CreateDirectory() method. It throws a DirectoryNotFoundException exception. I'll try to illustrate it: Suppose you have the...
7
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...
1
by: Alex | last post by:
Hello, in my company, we have a diagnostic tool for hardware. Depending on the hardware projcet, a different project configuration is needed. The configuration file is written in XML and...
5
by: Andy Lim | last post by:
Hello all, I just moved one of my ASP.NET application to a new hosting. But the same application that used to work perfectly before now returns this error: System.IO.DirectoryNotFoundException...
4
by: Jacques Wentworth | last post by:
I'm trying to access a Folder on a different Server using ASP.NET, and are getting a DirectoryNotFoundException. It works fine when I access the local drives on the server. I made sure the folder...
2
by: Matthias Ludwig | last post by:
I'm trying to create a directory on the web server with a vb.net code: .... Dim dirName As String = "w:\filepath\images" If Not Directory.Exists(dirName) Then...
1
by: Berryl Hesh | last post by:
I don't know where the "%" sysmbols are coming from, but without them this is a valid directory. I've pasted both the exception and code that triggeered it below. The purpose of this code block is...
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...
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
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.