473,842 Members | 1,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DirectoryNotFou ndException

I'm trying to access a Folder on a different Server using ASP.NET, and
are getting a DirectoryNotFou ndException. 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.GetFi les("C:\temp")
Dim dirs As String() = Directory.GetFi les("Q:\BARDATA .PRD")
Dim dir As String
For Each dir In dirs
Label1.Text = Label1.Text & dir & vbCrLf
Next
Nov 19 '05 #1
4 2227
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*****@Health Systems.co.za> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
I'm trying to access a Folder on a different Server using ASP.NET, and are
getting a DirectoryNotFou ndException. 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.GetFi les("C:\temp")
Dim dirs As String() = Directory.GetFi les("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.GetDi rectories("Q:\" )

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

HTH,
Axel Dahmen
------------
"Jacques Wentworth" <Ja*****@Health Systems.co.za> schrieb im Newsbeitrag
news:#R******** ******@TK2MSFTN GP15.phx.gbl...
I'm trying to access a Folder on a different Server using ASP.NET, and
are getting a DirectoryNotFou ndException. 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.GetFi les("C:\temp")
Dim dirs As String() = Directory.GetFi les("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*****@Health Systems.co.za> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
I'm trying to access a Folder on a different Server using ASP.NET, and
are getting a DirectoryNotFou ndException. 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.GetFi les("C:\temp")
Dim dirs As String() = Directory.GetFi les("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*****@Health Systems.co.za> wrote in message
news:eM******** ******@TK2MSFTN GP10.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*****@Health Systems.co.za> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
I'm trying to access a Folder on a different Server using ASP.NET, and
are getting a DirectoryNotFou ndException. 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.GetFi les("C:\temp")
Dim dirs As String() = Directory.GetFi les("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
53522
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 Directory.CreateDirectory(dirName) Label1.Text = "Directory created" Else
0
1551
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 'D:\appfolder\test2'. ASPNET has full control on the application folder. Any ideas why this fails? - Tom
4
4614
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 following (existing) directory: d:\Sites\MySite\ And you whant to create the following:
5
2884
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 What's wrong here? and how to resolve it?
1
1430
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 on his box. He is running Win2k3. I am running Windows 2000 Server. Running the same code I get: System.IO.DirectoryNotFoundException: Could not find a part of the path "\\usnynyc01ap002\uploadedfiles". Using the watch window in Visual Studio...
1
1702
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 DirectoryNotFoundException unhandled. It then gives me the directory that it cannot find and I know why it can't find it... It doesn't exist! What the program is now doing is concatenating the projects directory with the filename of the folder that...
0
1413
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 naturally placed the images in the project directory, then assembled them into a resource file using the resource editor, which VS2005 placed the final resource file in Properties\Resources.resx. All seemingly normal, no hiccups thus far. ...
1
5420
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 to gather a list of dll's. Thanks - BH Here is the Code /-------------------------------/
0
9715
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10314
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9453
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7858
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7038
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5696
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4499
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3145
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.