Tuesday, January 10, 2012

System.Security.SecurityException in CRM Plugin

I recently got the following error when trying to call the Bing Maps rest endpoint in a CRM 2011 plug-in. Since I wasn’t able to reproduce this in my test code, I did a search, and found out that calls to HttpUtility are not allowed in the sandbox environment for plug-ins for CRM Online.
I had the following piece of code:
HttpUtility.UrlEncode(...)
I changed it to:
Uri.EscapeUriString(...)
This resolved the issue, and now I am geocoding with no problems.

No comments: