locked
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-

    https://social.microsoft.com/Forums/en-US/4d06d3b3-2d3d-4a0a-a705-2c9f882d3ca2/crm-2011-get-page-url-in-plugin-code?forum=crmdevelopment 

    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