ASP.NET 2.0 SecurityException

Today I built the most trivial of ASP.NET 2.0 Web applications that called the most trivial of ASP.NET 2.0 Web services. I deployed both to IIS 6.0, and the one wouldn’t call the other. I was getting these, over and over:

Security Exception

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.

Resolution

Not very elegant here, but I added this to the web.config of the calling Web site, and it works:

<system.web>
   <trust level=”Full” originUrl=””/>
</system.web>

Found some research here and here.