Mono Class Library: System.Security.Principal NamespaceSystem.Security.Principal.WindowsIdentity Class |
See Also: WindowsIdentity Members
|
The WindowsIdentity class can also be used on POSIX compliant operating system.
[Edit]
C# Example // are we running on UNIX ? switch ((int)Environment.OSVersion.Platform) { case 4: // new value added by MS in 2.0 framework case 128: // old value used by Mono for 1.x framework // then if UID is 0 you're root! if (WindowsIdentity.GetCurrent ().Token == IntPtr.Zero) { Console.WriteLine ("Cool you're root!"); } break; default: Console.WriteLine ("You're not running on a Unix-like operating system"); break; } }
Namespace: System.Security.Principal
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0