Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Recently our Web hosting provider moved to a medium trust level for all shared ASP.NET site hosting. As a result, we're having some issues completing transactions via PayPal's SOAP API. Specifically, a SecurityException exception is being thrown with the following stack trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +58
   System.Net.ServicePointManager.set_CertificatePolicy(ICertificatePolicy value) +54
   com.paypal.sdk.core.APICallerBase.SetTrustManager() +30
   com.paypal.sdk.core.soap.SOAPAPICaller..ctor() +14 +23

I tracked down the source to the offending method in the PayPal SOAP SDK.

/// <summary>
/// To Accept all un-trusted certificate
/// </summary>
private void SetTrustManager()
    //This code is added to accept all un-trusted certificate i.e self-signed certificate
    if (Config.Instance.TrustAll)
       //ServicePointManager.CertificatePolicy = TrustAllCertificatePolicy.Instance;
       ServicePointManager.CertificatePolicy = new MyPolicy();                          
} // SetTrustManager

Does any know what change(s) need to be made to our project and/or the server to allow the SDK to function in a medium trust environment? Is it a necessity that all un-trusted certificates be accepted?

share|improve this question
i may be wrong, but this might do better on StackOverflow – Jimsmithkka Aug 27 '09 at 19:33
i initially posted it there, but my thought was a server admin may have some insight too. – user18619 Aug 27 '09 at 20:39

I'm afraid that's not supported, you need to use the classic HTTPS interface integration. Otherwise if you want to use the SDK by any means, then you have to enable the full trust mode on your server.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.