1

My website is deployed on IIS using an application pool with identity = A.

From this website, can I get the credential of A (full userName and passWord)? Please show me the code also.

string appPoolAccount = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
// Define Context
PrincipalContext context = new PrincipalContext(ContextType.Domain);
Cœur
  • 37,241
  • 25
  • 195
  • 267
Thien Long
  • 339
  • 2
  • 12

1 Answers1

1

The credentials for all app pools are stored, encrypted, in applicationHost.config (the IIS config file in the inetsrv directory). You could read the encrypted credentials and then call the IIS machine key encryption API to decrypt the password (https://msdn.microsoft.com/en-us/library/system.web.security.machinekey(v=vs.110).aspx)

Jeff
  • 35,755
  • 15
  • 108
  • 220