CliffsNotes:
The exception is coming because at some point the Csla.ApplicationContext.User.Identity.Name is getting reset to a different value. (not blank) This only happens in IIS with .NET 4.5. It's not happening with the VS dev server on the same box.
In my app I'm setting the Name property to a custom string containing the user's Id, app username, domain username, and email address. When the exception hits I am only seeing a portion of that string.
I've read a couple messages here about page redirects resetting the Name property and I'm sure there's something going on with that here, but the value is not blank as others have mentioned.
Any ideas why the jump from .NET 4.0 to 4.5 is causing this? Or why it doesn't happen with the VS web server? I thought 4.5 was supposed to be backward compatible with 4.0.
Thanks,
John
You do realize that 4.5 isn't yet in beta - everything available is pre-release preview code. Perhaps you can think of it as alpha code.
This is true for the pre-release on the downloads page, and also if you pull the current code from svn. The current code in svn is a lot different from that earlier pre-release, but has some very real issues with the data portal that I'm in the process of solving.
For the most part (other than on Silverlight) 4.5 will be backward compatible with 4.3. But that won't be true until 4.5 is actually done.
I was afraid my post was going to be a bit confusing. By 4.5 I meant .NET 4.5, not CSLA. I'm still using CSLA 4.3 in my app. Sorry about that.
John
Ahh, sorry, I see now what you are saying.
I don't know the answer, but can provide some info you may find useful in troubleshooting.
Csla.ApplicationContext.User delegates to HttpContext.Current.User in an ASP.NET host if you have Csla.Web.dll referenced in your project (so it is in the \bin folder).
As a side-note, if you don't have Csla.Web.dll in the \bin folder then you'll get incorrect results sometimes - but that's not new to .NET 4.5. The reason is that the default is to pull the principal from System.Threading.Thread.CurrentPrincipal, and that value isn't guaranteed to be consistent starting with ASP.NET 2.0.
If I understand your problem, you are basically finding that HttpContext.Current.User is being changed by IIS and/or ASP.NET 4.5. Perhaps this view on the problem will allow for some better search results or answers via ASP.NET forums or other sources.
Hmmm... I do have the Csla.Web.dll in the \bin folder. I'll do some more searching on HttpContext.Current.User and see what that turns up.
Thanks,
John
Copyright (c) Marimer LLC