开发者

Windows authentication(NTLM) in a silverlight application "Out of browser"

I've a web application, which works without any problem in my browser. But if I install it out-of-browser, when I try to get the username, the userAccount isn't in the dictionary:

private void Application_Startup(object sender, StartupEventArgs e) {
  string userId = e.InitParams["UserAccount"];//--> KeyNotFoundException
  //...
}

Which is normal because I give it through the launch of silverlight in the aspx web page:

<param name="InitParams" value="UserAccount=<%=HttpContext.Current.User.Identity.Name%>" />.

I need it because sometimes in my application, I need to display the current logged user, and display that it's this user which will do this or this act开发者_运维知识库ion before I save it.

So, one question:

  • How to manage to ensure that the user has the right to load the application AND retrieve the userId.

Thank you very much!

J4N


You should be able to set it client-sided like this:

e.InitParams["UserAccount"] = Environment.UserName;

This only gets the username though but does exactly the same as the other example you displayed.

However, it is never a good idea to set permissions based on a username provided by the client (which both this and your example does).


In fact it seems it isn't possible, I've to create a WCF service which return the current logged user.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜