public static WindowsIdentity GetAnonymous ()
{
WindowsIdentity id = null;
if (IsPosix) {
id = new WindowsIdentity ("nobody");
// special case
id._account = WindowsAccountType.Anonymous;
id._authenticated = false;
id._type = String.Empty;
}
else {
id = new WindowsIdentity (IntPtr.Zero, String.Empty, WindowsAccountType.Anonymous, false);
// special case (don't try to resolve the name)
id._name = String.Empty;
}
return id;
}