Here is a trivial console application that i run in 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 empty string as identity name. Why 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)?