Returns a WindowsIdentity object that represents the current Windows user.
In order to have sufficient permissions to call WindowsIdentity.GetCurrent( ) in SharePoint code, the application trust level must be set to WSS_Medium. This is done through changing the web.config file for the SharePoint application. (Typically resides in 'c:\Inetpub\wwwroot\wss\VirtualDirectories\80') Find the trust element and set the level attribute to WSS_Medium.
<trust level="WSS_Medium" originUrl="" />
Once the change is made, you'll need to restart IIS.