473,386 Members | 1,694 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,386 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 1613
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.