I am new to silverlight and working on a silverlight application hosted in mvc. User will login in aspx page /LogOn and will be redirected to either silverlight application or another view. To access logged user in silverlight Authentication service is added in mvc.
app.xaml.cs modified based on Enable authentication in RIA services
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
WebContext webcontext = new WebContext
{
Authentication = new FormsAuthentication()
};
this.ApplicationLifetimeObjects.Add(webcontext);
WebContext.Current.Authentication.LoadUser().Completed +=
(s, e) => MessageBox.Show(WebContext.Current.User.Name);
}
This is approach is not working as Message box is shown as empty