Csla.ApplicationContext.User not holding my Custom Principal object

Csla.ApplicationContext.User not holding my Custom Principal object

Old forum URL: forums.lhotka.net/forums/t/11767.aspx

TommyB posted on Thursday, January 03, 2013

I am developing a POC for a customer using the following technologies.



I have been running into some issues with the Csla.ApplicationContext.User not holding my Custom principal object.  When a user has logged in, it reverts back to the regular principal object when I enter any controller context.  Here is the relevant code:

In my global.asax.cs


        protected void Application_AuthenticateRequest(Object sender, EventArgs e)


            //if (Csla.ApplicationContext.User != null &&

            //    Csla.ApplicationContext.User.Identity.IsAuthenticated &&

            //    Csla.ApplicationContext.User.Identity is FormsIdentity)

            HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];

            if (authCookie != null)


                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);

                if (ticket != null && ticket.Name != string.Empty)




If the user is authenticated this code executes and the Csla.ApplicationContext.User contains my RmsPrincipal object, roles and all.  However, as soon as I get to my controller logic, the Csla.ApplicationContext.User has reverted back to the regular principal object.
Originally I had forgotten to reference the Csla.Web assembly in addition to Csla.Web.Mvc.  This did not resolve the issue.
Any help would be greatly appreciated.


Copyright (c) Marimer LLC