Dynamics CRM 4.0 –Custom ASPX Page in a Multi-Tenancy Environment

 

When OnPremise Dynamics CRM 4.0 is configured with a single organization, it sends the organization name in the query string.

When OnPremise Dynamics CRM 4.0 is configured with multiple organizations, it sends the organization name in the path.

Here’s how to do a quick fallback if you need the custom page to work in both environments.

// grab the incoming request parameters
Trace.Write("Request.ApplicationPath: " + Request.ApplicationPath);
Trace.Write("Request['orgname']: " + Request["orgname"]);

// Multi-tenant CRM installations will have the Org Name as part of the Application path.
if (Request.ApplicationPath != "/")
{
    _orgName = Request.ApplicationPath.Replace("/", "");
}
else
{
    _orgName = Request["orgname"];
}
Trace.Write("orgname: " + _orgName);

Hope this helps!

// Dave

This entry was posted in Development and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *