PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET System.IO.DirectoryNotFoundException: Could not find a part of the path

Reply

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

 
Thread Tools Rate Thread
Old 02-10-2003, 08:43 AM   #1
Matthias Ludwig
Guest
 
Posts: n/a
Default 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.IPostBackEve
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




  Reply With Quote
Old 19-11-2003, 10:24 PM   #2
Matthias Ludwig
Guest
 
Posts: n/a
Default System.IO.DirectoryNotFoundException: Could not find a part of the path

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

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.IPostBackEv

e
>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
>
>
>
>
>.
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off