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.
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.