LoginSettings ls = LoginSettingsCache.GetLoginSettings(EnvironmentManager.Instance.MasterSite);
var sid = ls.UserIdentity; // Works with domain user, not machine user
As the code says, when logging in as a domain user the sid is valid but not when logging in as a local user. Why is this and how can I find out the SID?