I am new to web application. I have created a custom principle and trying to set it in CurrentDomain. This code works perfectly in WPF application. But here it is throwing Policy Exception "Default principal object cannot be set twice."
var principal = new CustomPrinciple(currentIdentity);
Thread.CurrentPrincipal = principal;
AppDomain.CurrentDomain.SetThreadPrincipal(Thread.CurrentPrincipal);
My CustomPrincple is derived from ClaimsPrinciple
public class CustomPrinciple : ClaimsPrincipal
{ }
I am wondering why I am not allowed to set it here. How can I set my custom principle in web application.