Get server URL to generate record URL in plugin for CRM Online RRS feed

  • Question

  • Hello,

    I want to generate a record URL in a plugin for CRM Online.

    I am using the following code in my class- 

    HttpContext webContext = HttpContext.Current;

    entity.Attributes["new_addressurl"] = string.Format("http://" + webContext.Request.Url.Host + ":" + webContext.Request.Url.Port + "/" + context.OrganizationName + "/userdefined/edit.aspx?etc=1071&id=" + recordId.ToString());

    But, after the line containing "HttpContext" it is throwing the following exception-

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

    I have referred the following link-


    I think that "HttpContext" is not supported in Sandboxed plugin for CRM online.

    Is there any work around for this?

    Thanks for your help in advance.

    Thursday, November 26, 2015 10:12 AM

All replies