web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Request for the permission of type System.Net.WebPermission failed - in sandbox plugin

(0) ShareShare
ReportReport
Posted on by

Hello,

I am trying to access a licensing server to activate a product from a plugin in CRM 2013 online. The plugin is in sandbox and I get the error :

Request for the permission of type 'System.Net.WebPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


The code where this error arise is:

licensingClient = new CustomHardwareIdLicensingClient(LicensingServiceUrl,
tmpl,
productKey,
licenseKeyValidationData,
productIdOnLicensingServer);

licensingClient.AcquireLicense();


where LicensingServiceUrl="http://www.softactivate.com/SampleLicensingService/"


I have studied the CRM 2013 SDK example about the WebClientPlugin which make explicit use of System.Net.WebClient class to access an external site from a plugin, it's ok, but in my case  the access to external site is included in the call:

licensingClient.AcquireLicense();

 and the I get the above error.

Please, if you have any solution to my problem.

Regards, 

Radu Antonache

*This post is locked for comments

I have the same question (0)
  • Mitch Milam Profile Picture
    on at

    I think what you are seeing is a .NET trust issue. plugins in CRM Online run in Partial Trust and I have a feeling that the assembly you are referencing is running in full trust, which is being stopped by the Sandbox process.

  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi Radu,

    The System.Net namespace can be used, but there are restrictions on the operations allowed within that assembly. i.e., you can call to a web service using a friendly URL but not by IP address. The licensing client is trying to perform some operation within the namespace that can't run in partial trust.

    If you need to run this code (and it's from a 3rd party and you can't change it), you would need to host it outside of CRM and invoke the code from the plugin.

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

     Aiden

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans