0

How do I programmatically persist the network access credential in Credential Manager that can be used across users?

(The reason is, I have two users accounts in my machine. One of my services runs under one particular user account. My UI app runs under another user account. From the UI, I am trying to persist the credential for the network access. But the service is not able to access the network drive as it runs under different user account)

1
  • The Credential Manager is a per-user item; it's not designed to be shared across multiple users. You should construct a channel for communication from the UI to the service so that the service can persist the credentials itself. (a potential other solution to this is to run the service as the same user as the UI). Jun 2, 2014 at 18:51

1 Answer 1

1

You can perform impersonation to access the drive. Find the explorer process running in another user account & get the process token of it. Create a new thread in your service & use SetThreadToken API to set the explorer token to your thread. This thread now will run in the other user account & can gain access to the network drive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.