Hello Anuma and thank you for your response. I tried the code you provided and I got this error:
System.Security.SecurityException was unhandled by user code
Message="Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, ...