开发者

How do I access enviroment variables in a WPF Browser application

HI am interested in obtaining getting the Enviroment.UserName in a Wpf Browser application. But I have run into a SecurityException. What changes should开发者_运维知识库 I make obtain the enviroment variables.

Update: the application is run on my company intranet.


The Environment.UserName property getter asks for a demand on the EnvironmentPermission.Read permission. Yeah, that's going to blow in a sand-boxed environment such as created to run code securely inside a browser. A web app has no business obtaining privileged information such as the user name. It is half-way to being able to crack the user's login credentials, albeit that the password would be a bit harder to guess.

No can do, if you want the user to reveal her user name then you are going to have to ask her politely. And do make sure that's a name that you provide, don't expect her to reveal the name she uses to logon to her machine.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜