【发布时间】:2011-03-29 18:58:08
【问题描述】:
我有一个网络应用程序,它在我的浏览器中运行没有任何问题。但是如果我在浏览器外安装它,当我尝试获取用户名时,userAccount 不在字典中:
private void Application_Startup(object sender, StartupEventArgs e) {
string userId = e.InitParams["UserAccount"];//--> KeyNotFoundException
//...
}
这很正常,因为我是通过在aspx网页中启动silverlight给它的:
<param name="InitParams" value="UserAccount=<%=HttpContext.Current.User.Identity.Name%>" />.
我需要它,因为有时在我的应用程序中,我需要显示当前登录的用户,并显示在我保存之前执行此操作或此操作的是此用户。
那么,一个问题:
- 如何管理以确保用户有权加载应用程序并检索 userId。
非常感谢!
J4N
【问题讨论】:
标签: .net silverlight iis authentication out-of-browser