Method of using Reflection to get current executing user? Or, find out which user an application pool runs as?
Is there some way to use reflection to get the name of the user who is currently executing as? Or if that isn't possible, is there a way to find out which user the current application pool is running as?
Main reason I ask is as a part of the new nGallery release, we are working on a setup package that takes care of setting up all the necessary permissions for the user. Sometimes though, people cannot use the installer, such as when they have webhosting. So we'd also like to include a page in the admin section that checks to make sure all of the permissions are right, and if not, says which directory to give the user access to. Part of the problem is we can't generalize and say “grant access to ASPNET for IIS5 and Network Service for IIS6”, since it is possible the webhost has the user in a special application pool that might be running as a different user.