I create my own IPrincipal and IIdentity implementation as shown below:
[ComVisible(true)]
[Serializable]
public sealed class Custo
Your mistake is here:
_application.AuthenticateRequest += ApplicationAuthenticateRequest;
There is a HttpModule named RoleManagerModule that invokes a method in HttpApplication.PostAuthenticateRequest and sets the HttpContext.Current.User to RolePrincipal. So, you were setting the User in AuthenticateRequest and the RoleManagerModule sets it in PostAuthenticateRequest, means after your set, so overrides your settings. Change your Module.Init:
public void Init(HttpApplication context) {
_application = context;
// change just this line:
_application.PostAuthenticateRequest += ApplicationAuthenticateRequest;
}
IMPORTANT UPDATE:
Please see this question -asked by starter again, depended on current question- for a second solution, if this one doesn't work.