In order to setup my web application I need to give a full control to a certain folder for a 'NETWORK SERVICE'
account. It works fine, but on a non English systems I'm getting System.Security.Principal.IdentityNotMappedException
. This is because the name of this built-in account is localized for that system (I'm using harcoded value 'NETWORK SERVICE'
).
Is there a way to find out programmatically what the localized version of 'NETWORK SERVICE'
is?
Just use this code:
var account = new SecurityIdentifier(WellKnownSidType.NetworkServiceSid, null).Translate(typeof(NTAccount)).Value;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With