How to create a relative URL in site map to static content under the ISV folder in CRM 4
If you need to have a relative URL in site map for a subarea to something in the ISV folder, the first try usually is something like:
<SubArea Url="/ISV/CustomPage.htm" …
This will result in this URL: https://crmserver/organization/ISV/CustomPage.htm
And you will receive a HTTP 404 error (Not Found):
You could use an absolute URL like:
<SubArea Url="https://crmserver/ISV/CustomPage.htm" …
But, you will have a problem, if you need this to work also for the IFD users.
The explanation:
To support multiple organizations in a single deployment, Microsoft Dynamics CRM 4.0 uses the Virtual Path Provider to dynamically insert the organization name in the URL. This means that the developers need to consider how the Virtual Path Provider affects their custom code.
For example, when you place your web custom page in the ISV directory under the Microsoft Dynamics CRM web site and you reference your custom web page with a relative path as /ISV/CustomPage.htm. When you click this link in Microsoft Dynamics CRM, you will receive an error that IIS cannot find the web page.
The reason is that Microsoft Dynamics CRM will translate the URL to https://crmserver/organization/ISV/CustomPage.htm and because your page actually resides at https://crmserver/ISV/CustomPage.htm.
Basically, Microsoft Dynamics CRM automatically adds the organization name to the URL when users access web pages from the site map.
The ASPX is handled differently than HTML, since HTML is not dynamic content (except for some JavaScript), like an ASPX page is.
Solutions:
· Since we re-direct requests to support multiple organizations, we need to reference your URLs with /../ISV/CustomPage.htm, in order to bypass the virtual path provider.
· Other option is a JavaScript function called prependOrgName (available in the SDK) to prepend the organization name, if you need to (but you shouldn’t if you use /../ISV path).
PrependOrgName Function
https://msdn.microsoft.com/en-us/library/cc905758.aspx
· Or simply rename the static code file from .HTM to .ASPX, to be handled by the Virtual Path Provider.
Best Regards
EMEA Dynamics CRM Team