« Return to Thread: Compiling C# program with Request object

Re: Compiling C# program with Request object

by Damien DALY-2 :: Rate this Message:

Reply to Author | View in Thread

I had been trying to use: System.Environment.GetEnvironmentVariable, which
works perfectly on the CLI, but when I run it in the IIS CGI environment I
get:

Unhandled Exception: System.Security.SecurityException: Request for the
permission of type 'System.Security.Permissions.EnvironmentPermission,
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed

So I guess I need to grant it permissions to get the environment variable,
but I don't have a clue how to do this.

Hi,

This is about the user the CGI runs...
In most cases, IIS user is IUSR_machine, a kind of equivalent to unix user "none".

Due to security restrictions of the IUSR_machine user, it can't acces to its environement variables. So you have to search in IIS how you can change the user it uses for CGI access...

Good luck

Damien

_______________________________________________
Mono-list maillist  -  Mono-list@...
http://lists.ximian.com/mailman/listinfo/mono-list

 « Return to Thread: Compiling C# program with Request object