on-internet
← Community

Thread.CurrentPrincipal in .NET console application

Stack Overflow ·

Here is a trivial console application that I run in a command prompt: using System; using System.Threading; namespace Test { internal class Runner { [STAThread] static void Main(string[] args) { Console.WriteLine(Thread.CurrentPrincipal.GetType().Name); Console.WriteLine(Thread.CurrentPrincipal.Identity.Name); } } } The output is 'GenericPrincipal' and an empty string as identity name. Why is there the run time constructs GenericPrincipal instead of WindowsPrincipal? How do I force it to construct WindowsPrincipal from the security token of the starting process (cmd.exe in my case)?

Comments

Sign in or sign up to comment and upvote.

No comments yet.