Search code examples
c#active-directoryuser-accounts

An application using a windows account to access a directory


There is a directory on a file_server, which can be accessable from AD account -> TRacc,

I am tring to write an application which will be working on an application_server and using the TRacc account to access this directory and put some files into it.

So how to associate an windows account with a c# application


Solution

  • There are two ways of doing this.

    1). Build your app in C#, and when you go to launch it, Hold "Shift" and right click the *.exe file and select "Run As". You will be prompted for Your Username, Password & Domain. Use the Tracc account details and your app will work fine.

    2). Create a Process within your application. Provide the Username, Secure Password and Domain for the process.

    I would go with option 1. As hard coding the password details into your app means anyone running it can perform tasks, which isn't good.

    Hope this helps.