Returns a System.Security.Principal.WindowsIdentity object that you can use as a sentinel value in your code to represent an anonymous user. The property value does not represent the built-in anonymous identity used by the Windows operating system.
An object that represents an anonymous user.
This property returns an empty System.Security.Principal.WindowsIdentity object that enables you to treat operations as anonymous. The property value does not correspond to a Windows anonymous user and cannot be used for impersonation. Also, note that the identity returned by this property is not static; each call to WindowsIdentity.GetAnonymous returns a different anonymous identity.
You can use the WindowsIdentity.IsAnonymous property to detect the return value from WindowsIdentity.GetAnonymous. However, WindowsIdentity.IsAnonymous detects both the Windows anonymous identity and the anonymous identity returned by this method. To use the latter identity, cache the WindowsIdentity.GetAnonymous return value instead of relying on the WindowsIdentity.IsAnonymous property.