George
George

Reputation: 77

Accessing Network Shares using C# ASP.NET

I am having issues trying to access network shares using C# and ASP.NET web based application. I use LDAP Active Directory to perform the login and I have a method that reads files from a specified directory and performs file moves. The directory is shared to specific users and I am unable to access them unless they are shared to the "Everyone" group (which is not how we want to set the security). I would like to access the directories using the username on my AD login somehow. Is this possible? I have been looking into the Directory Security class but no luck so far. Thanks.

Upvotes: 0

Views: 724

Answers (2)

Rune FS
Rune FS

Reputation: 21752

There's two ways to solve this grant the User the app pool rums under access to the share or impersonate the AD user when you need to access the share

Upvotes: 1

Ron Harlev
Ron Harlev

Reputation: 16703

Change the impersonation on your web.config file to a user that have access permission to the share

<identity impersonate="true"
      userName="domain\user" 
      password="password" />

Upvotes: 1

Related Questions