DirectoryNotFoundException

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
 
K

Ken Cox [Microsoft MVP]

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
 
A

Axel Dahmen

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
 
J

Jacques Wentworth

Hi Ken

How can I give the ASPNET user access to the remote drive?

Jacques
 
K

Ken Cox [Microsoft MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,609
Members
45,253
Latest member
BlytheFant

Latest Threads

Top