5
我是silverlight的新手,正在研究mvc中托管的Silverlight应用程序。用户将登录aspx页面/LogOn,并将被重定向到silverlight应用程序或其他视图。在silverlight中访问记录的用户在mvc中添加认证服务。在mvc中进行身份验证并重定向到silverlight,如何访问经过身份验证的用户?
app.xaml.cs基础上改装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);
}
这方法是行不通的消息框显示为空