That assembly does not allow partially trusted callers while using HttpUtility.UrlEncode in CRM – Nishant Rana’s Weblog

Nishant RanaDyn365CE7 years ago48 Views

Hi,

We got the below error in one of our Sandboxed Plugins

“System.Security.SecurityException: That assembly does not allow partially trusted callers”.

We realised it was because of using System.Web.HttpUtility class


We replaced it with EscapeDataString method and this fixed the issue.

System.Uri.EscapeDataString()

Helpful thread

https://stackoverflow.com/questions/3840762/how-do-you-urlencode-without-using-system-web

Hope it helps..

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
May 2025
MTWTFSS
    1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
« Apr   Jun »
Follow
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...