RUNAS command line utility
The other day, I ran into a problem where I needed to chase down a security bug. I was logged in as "User A", and I had granted "User B" special rights over the Exchange server that I was querying against.
When "User A" attempted to connect to certain resources, permission was denied. "User B" should have rights over those resources. The question was, how do I run the process as "User B" but stay signed in as "User A"?
The answer is the RUNAS command line utility. This lets you kick off a process with a given impersonation. For example:
RUNAS /user:starbucks\administrator c:\myapp\myapp.exe
You can also get the same effect when holding down the Shift key and right-clicking on the executable in Explorer.
-------------
Don't forget, to hook your app into Windows authentication, use AppDomain.SetPrincipalPolicy to indicate that you wish to have a WindowsPrincipal, and use Thread.CurrentPrincipal.Identity to get the identity of the user.