I'm not sure if this behaviour is by design or a minor bug. If I have an MVC website using authentication it seems I must have Csla.Web referenced for it to work correctly.
My website compiles with or without the assembly but after compiling without it looks like setting the ApplicationContext.User doesn't set the underlying HttpContext.User object. e.g. if I add this after authentication I get true and false respectively.
Debug.WriteLine(Csla.ApplicationContext.User.IsInRole("Administrator"), "Csla.ApplicationContext.User.IsInRole"); // true
Debug.WriteLine(User.IsInRole("Administrator"), "HttpApplication.User.IsInRole"); // false
Seems a bit odd. Is this to be expected?
When building applications in ASP.NET you should reference:
When building ASP.NET MVC applications you should additionally reference:
Csla.Web.dll contains some important ASP.NET support, including web-specific behaviors for ApplicationContext.
You should also be aware that there's a bug in the ApplicationContext implementation in 4.0.0 that is fixed in 4.0.1. This bug should only affect you in a couple scenarios:
If you encounter issues, try using 4.0.1, as it fixes the bug.
Thank you for the clarification Rocky.
Copyright (c) Marimer LLC