tags:

views:

31

answers:

1

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.

+2  A: 

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.

Hans Passant
This application is being run in our company enviroment... I have done this before in a asp.net application years ago. This is my first attempt at a wpf application.
Brad
usernames are not private in our company...it's common knowledge and readably accessible.
Brad
It just isn't very clear to me why you have to run this WPF code inside a browser. You'll have zero problems if you don't. No idea if it is even possible to tweak the IE sandbox, google hits only ever talk about how to make it stronger, not weaker. You'll find the kind of people who would know at serverfault.com
Hans Passant
Yeah I am out on a limb here...and I am not sure what technology I should be using for my project. Thanks for your input.
Brad