【发布时间】:2011-05-27 10:51:36
【问题描述】:
我是 silverlight 的新手,正在开发一个托管在 mvc 中的 silverlight 应用程序。用户将登录 aspx 页面 /LogOn 并将被重定向到 silverlight 应用程序或其他视图。在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);
}
这种方法不起作用,因为消息框显示为空
【问题讨论】:
标签: c# asp.net asp.net-mvc silverlight forms-authentication