J
John Bowman
Hi All,
I've got a simple wrapper static test method on a class to expand the
environment variables on a specified string:
public static string ExpandEnvironmentStr(string Str)
{
return Environment.ExpandEnvironmentVariables(Str);
}
For some apparently security related reason it crashes with the following
exception:
An unhandled exception of type 'System.Security.SecurityException' occurred
in mscorlib.dll
Additional information: Request for the permission of type
System.Security.Permissions.EnvironmentPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
Being a security newbe I just can't figure out from the MS doc's what this
means and how to use the EnvironmentPermission to fix it. The doc's only
confused me completely. All I need to do is be able to read stuff from the
Environment class (expanding variables and retreiving special folders,
etc.). All the MS doc's examples say something like this... which doesn't
help me at all. I need to know HOW to keep it secure.
// <-- Keep this information secure! -->
Do I need some kind of assembly permission attribute in the AssemlyInfo.cs
file or some kind of attribute on this method? If so, what? Can someone
please explain this to me and give me working example? I'm baffled.
Many thanks in advance,
I've got a simple wrapper static test method on a class to expand the
environment variables on a specified string:
public static string ExpandEnvironmentStr(string Str)
{
return Environment.ExpandEnvironmentVariables(Str);
}
For some apparently security related reason it crashes with the following
exception:
An unhandled exception of type 'System.Security.SecurityException' occurred
in mscorlib.dll
Additional information: Request for the permission of type
System.Security.Permissions.EnvironmentPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
Being a security newbe I just can't figure out from the MS doc's what this
means and how to use the EnvironmentPermission to fix it. The doc's only
confused me completely. All I need to do is be able to read stuff from the
Environment class (expanding variables and retreiving special folders,
etc.). All the MS doc's examples say something like this... which doesn't
help me at all. I need to know HOW to keep it secure.
// <-- Keep this information secure! -->
Do I need some kind of assembly permission attribute in the AssemlyInfo.cs
file or some kind of attribute on this method? If so, what? Can someone
please explain this to me and give me working example? I'm baffled.
Many thanks in advance,