473,396 Members | 2,023 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.

DirectoryInfo exists and shared 2000 server directories

I try to read a shared directory. This shared directory is on a 2000
server.

When I use DirectoryInfo.Exists, I always have "This directory does
not exist".

If the shared directory is on a Windows XP computer or on a Windows
2000, it works only if I add the same user on all computers.

What do I have to do on Windows 2000 Server if I want to read my
directory from a C# windows service ?
Does it work better from a C# windows application ?

Computer 1 Windows 2000 Server (workgroup): Shared directory
\\SERV1\DIR
Computer 2 Windows 2000 Server (workgroup): \\SERV2\DIR
Computer 3 (workgroup): The user is SERV3\John
The service is on SERV3. It is started with .\john profil.
Thanks for any advice
Jul 21 '05 #1
1 1614
It sounds like you have a permissions issue. As you have already found
out, the user (which by default for a service is Local System) must have
rights to the directory. The default user for a service does not have
these rights.

You can do one of two things, depending on the security requirements
where this application is running. 1) Start the service with a
different user that does have the rights. This normally will not be
allowed by your IT security manager. 2) Have the service impersonate a
user that has the rights during the code path that needs to check the
existence of the directory. Much more secure, but harder to write.

HTH

David

"Chris" <ch*********@hotmail.com> wrote in message
news:6a**************************@posting.google.c om:
I try to read a shared directory. This shared directory is on a 2000
server.

When I use DirectoryInfo.Exists, I always have "This directory does
not exist".

If the shared directory is on a Windows XP computer or on a Windows
2000, it works only if I add the same user on all computers.

What do I have to do on Windows 2000 Server if I want to read my
directory from a C# windows service ?
Does it work better from a C# windows application ?

Computer 1 Windows 2000 Server (workgroup): Shared directory
\\SERV1\DIR
Computer 2 Windows 2000 Server (workgroup): \\SERV2\DIR
Computer 3 (workgroup): The user is SERV3\John
The service is on SERV3. It is started with .\john profil.
Thanks for any advice


Jul 21 '05 #2

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

Similar topics

1
by: Peter Somu | last post by:
Hello, It seems like the method DirectoryInfo.Exists does not work for network mapped directories. Is this true? If so, what mechanism is there to verify that a netowork directory exists? ...
1
by: Chris | last post by:
I try to read a shared directory. This shared directory is on a 2000 server. When I use DirectoryInfo.Exists, I always have "This directory does not exist". If the shared directory is on a...
1
by: siddharth_jain_1 | last post by:
Hello I am trying to get a list of shared files and subdirectories in a particular folder on a server. For this I am using DirectoryInfo in the following way. DirectoryInfo folder = new...
7
by: Charts | last post by:
I login as administrator of the machine. However running the following code get access denied exception for file inside the directory. The source code: DirectoryInfo target = new...
0
by: Tapasvi Mehta | last post by:
I am trying to read directories that are on mapped drive using DirectoryInfo class, and it does not allow it. 1) From development box mapping a drive that is on Windows NT machine. 2) Trying...
13
by: Tom Scales | last post by:
OK, I admit, I am not a VB.NET expert and am still learning, but have run into an annoying problem. I'm writing a program that has to search the file system and therefore processes large numbers...
5
by: AE Guy | last post by:
**I just realized I initially posted this in the wrong group, sorry to those of you who see it twice I have a windows service written in C# that WAS moving files individually. Now I am trying to...
2
by: rn5a | last post by:
Suppose I have the following code: <script runat="server"> Sub Page_Load(.....) Dim dInfo As DirectoryInfo Dim fsi As FileSystemInfo dInfo = New DirectoryInfo(Server.MapPath("Folder1")) ...
3
by: Steve Kershaw | last post by:
Hi, I need a way to bind a DirectoryInfo array to a GridView without any errors. The code I'm using to create the DirectoryInfo array is: // Define the current directory DirectoryInfo dir...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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.