I have assign Csla.ApplicationContext.User successfully like below
private static bool SetPrincipal(MyIdentity identity)
{
if (identity.IsAuthenticated)
{
MyPrincipal principal = new MyPrincipal(identity);
Csla.ApplicationContext.User = principal;
}
return identity.IsAuthenticated;
}
but when i check Csla.ApplicationContext.User in silverligth, i always equals "" ,please help me!
The code you show in your post - is that running on the client workstation?
If so, then Csla.ApplicationContext.User should have the value you set. I'd recommend walking through that code in the debugger to make sure it is actually running.
If you aren't running that code on the client, then you need to do so. Silverlight doesn't automatically have a principal, and you need to explicitly set the principal on the client.
the code running on the Business Class Library, i refer to you Csla sample,
What 's your mean by client workstatioin?
Could you please provide me sample code for silverlight?your book not includes Silverlight.
The Expert 2008 Business Objects book was written before Silverlight was out, so it doesn't include Silverlight.
You can find a lot of Silverlight content and samples in CSLA .NET 3.7 and higher from www.lhotka.net/cslanet/download.aspx.
What I mean by 'client workstation' is the client machine - the computer the user is actually using.
If you are building an ASP.NET application, the code you showed would be running on the web server. But if you are creating a Windows Forms, WPF or Silverlight application that code would be running on the user's computer (the client workstation).
Thank you very much!
Copyright (c) Marimer LLC