DirectoryInfo exists and shared 2000 server directories

C

Chris

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
 
D

David Williams , VB.NET MVP

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
 

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

Top