473,396 Members | 1,749 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,396 software developers and data experts.

DirectoryNotFoundException

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
Nov 19 '05 #1
4 2200
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

"Jacques Wentworth" <Ja*****@HealthSystems.co.za> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
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


Nov 19 '05 #2
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
------------
"Jacques Wentworth" <Ja*****@HealthSystems.co.za> schrieb im Newsbeitrag
news:#R**************@TK2MSFTNGP15.phx.gbl...
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

Nov 19 '05 #3
Hi Ken

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

Jacques
Ken Cox [Microsoft MVP] wrote:
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

"Jacques Wentworth" <Ja*****@HealthSystems.co.za> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
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


Nov 19 '05 #4
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/de...ersonation.asp

http://msdn.microsoft.com/library/de...haspdotnet.asp

http://groups.google.ca/groups?hl=fr...13%26rnum%3D11

"Jacques Wentworth" <Ja*****@HealthSystems.co.za> wrote in message
news:eM**************@TK2MSFTNGP10.phx.gbl...
Hi Ken

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

Jacques
Ken Cox [Microsoft MVP] wrote:
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

"Jacques Wentworth" <Ja*****@HealthSystems.co.za> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
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

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
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...
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...
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...
1
by: Larry Viezel | last post by:
Two developers here are working on the same code in slightly different environments. Jason programmed code to access a public folder on an outside machine "\\usnynyc01ap002\". The code works fine...
1
by: Bruce W. Darby | last post by:
My application, prior to building it into an .exe, was working as it should. As soon as I performed the build and attempted to run the application outside the IDE, I got an error message stating...
0
by: Dan Christensen | last post by:
Hi, I've been using MSBee to build a small program for some time now (since not everyone seems to have the 2.0 CLI installed yet). Recently I decided to add some buttons that used images, so I...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.