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

Re: Compiling C# program with Request object

by theallan :: Rate this Message:

Reply to Author | View in Thread

Hi Robert,

Thanks for the reply!

> Well, a HttpContext is only available to ASP.NET applications.

Okay - I see. Don't particularly want to make it an ASP.NET application.

> Get them from the environment (see the CGI specs) or resort to ASP.NET.

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.

Thanks
Allan

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