By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,375 Members | 1,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,375 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.