Alternative to HttpUtility.UrlEncode in Dynamics CRM Online

If you try to use HttpUtility.UrlEncode in your plugin or workflow code, you’ll get a security error:

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

Because it’s not allowed in CRM Online.

Instead, we should use this one:

Uri.EscapeDataString

One thought on “Alternative to HttpUtility.UrlEncode in Dynamics CRM Online

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s