GetDirectories UNC path - Acces Denied

  • Thread starter Thread starter frederik
  • Start date Start date
F

frederik

Hi

The website have to show subdirectories on a network drive.

I use the following code:

string[] directories;
directories=Directory.GetDirectories(_Path);
....

The _Path contains an url like \\server\directory\subdirectory\
Impersonate is set to true

When i try the code from the localhost, i receive the subdirectories.

When i try the _Path directly in my browser, i see the subdirectories.

I copied the dll to the production server.
When i use this dos command line to check if i have rights to read the
_Path, everything works fine. (runas :user:username cmd)
from this cmd screen i have acces to the _Path

When i try the website, i receive always access denied, even if
impersonate is set to true.
Can someone explain me more about this problem ?

frederik
 
I think the account that you are running IIS and asp.net on production server
don't have access permission to the network path.
 
Make sure that you are impersonating with an account that is set up on the
remote server rather than trying to pass authentication around from one
domain to another.
 
We cannot change the structure.

I think that the account i'm impersonating with is correct setup
because when i copy the project on my own pc, it's working fine.

Even if i try to contact de folder from the server to the remote
server, i have acces with my account. Only if it's running under a
website i receive accessdenied.

But why with IIS on the server and NOt with IIS on my local pc

frederik
 
Back
Top