using System.Diagnostics; ... var currentUserProfile = Profile.CurrentUserProfile;
var userName = Profile.CurrentUserProfile.UserName;
var userId = Profile.CurrentUserProfile.UserId;
var userSid = Profile.CurrentUserProfile.Sid;
var domainName = Profile.CurrentUserProfile.DomainName;The Profile class is available in the System.Diagnostics.Profile package library. While it is a part of the standard .NET framework, it may require additional permissions to access some of its properties.