Medium Trust Error: System.Net.WebPermission

Error: Security Exception

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.

Source Error:

[No relevant source lines]

Source File:

App_WebReferences.tgtiiclt.0.cs Line: 61

Stack Trace:

[SecurityException: Request for the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]

The System.Net.WebPermission controls allow ASP.NET applications to make calls to remote web services such as PayPal, authorize.net, UPS, FedEx, and other services. The default configuration for this in Medium Trust is to restrict this to web services which only run on "$OriginHost$". Simply put the domain.com may only access web services on domain.com and unless these URIs have been approved on the server.

If you receive this type of error please contact support with the URI that is being used in the ASP.NET code. These URIs must meet one of the following criteria:

  • URI must utilize SSL/https and the certificate must be valid OR URI must be reputable source.
  • URI requires authentication

In order to properly review the URI the exact URI is needed, for example https://gateway.fedex.com. Please contact support with any further questions regarding this error.