Because, by default, code executing in the Intranet zone only has read access to the username environment variable and no access to any other environment variable.
-----Original Message----- From: Jeff Roberts [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 26, 2002 9:10 AM To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Environment.ExpandEnvironmentVariables throws a security exception why would a Environment.ExpandEnvironmentVariables call throw an exception while being executed out of the Intranet security zone ? The exception was "Request for the permission of type System.Security.Permissions.EnvironmentPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed." Sample Code: string PrivateDir = Environment.ExpandEnvironmentVariables("C:\\Folder"); You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.