DirectoryNotFoundException

  • Thread starter Thread starter Jacques Wentworth
  • Start date Start date
J

Jacques Wentworth

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 does exist.

I've put my code below to show what I'm trying to do.

Thanks
Jacques Wentworth


'Dim dirs As String() = Directory.GetFiles("C:\temp")
Dim dirs As String() = Directory.GetFiles("Q:\BARDATA.PRD")
Dim dir As String
For Each dir In dirs
Label1.Text = Label1.Text & dir & vbCrLf
Next
 
Is Q: a mapped drive?

If so, it may be mapped for the logged on user but not the ASPNET user.
Also, the ASPNET user probably doesn't have permissions to access a remote
drive.

Ken
 
Try

Dim d As String() = Directory.GetDirectories("Q:\")

to see if the directory's name differs from what you think it should be.

HTH,
Axel Dahmen
 
You need to use impersonation. You use an account that is in the domain of
the remote server when trying to fetch data from that server. You may be
able to create an ASPNET user on that machine with the same password as used
on the Web server. Not sure about that part.

Also, don't use a mapped drive but a UNC path:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconimpersonation.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/authaspdotnet.asp

http://groups.google.ca/groups?hl=f...lm=%23%23wjwMVGCHA.2696%40tkmsftngp13&rnum=11
 
Back
Top