CRM 4.0 introduced many changes to the way URLs need to be constructed.
In MSCRM 3.0 and earlier, you could simply access a page by using a URL such as ht.tp://<crmserver:port>/default.aspx
The introduction of multi-tenancy and CRM Online/IFD deployments required changes to the URL formats. Both CRM online and IFD deployments require URLs of the form ht.tps://orgname.mycrmhost.com – This was mainly done for reasons related to securing cookie domains, but also helps provide organization specific URLs.
Things are a little bit different for on-premise CRM installations.
a) we need a way to indicate which organization the user is trying to access – The format used here is: /orgname/page.aspx”>/orgname/page.aspx”>ht.tp://<crmserver:port>/orgname/page.aspx
b) We actually don’t create virtual directories for every organization. MSCRM implements a virtual path provider that parses the URL to figure out which organization you are accessing and help in performing the correct authentication (verifying that the user is a member of that organization etc).
c) For on-premise deployments, if a user just types in a URL without an organization name (such as ht.tp://crmserver), MSCRM would try to service the request for the user’s default organization.
One of the common questions is around accessing custom pages and the correct URL format for that.
Rich Dickinson on the CRM PM team compiled an excellent list of when the custom page should be accessed using an org specific URL and the table below is based on that compilation.
URL to access what object?
Format for On-Premise Deployments
Format for IFD deployments
Format for CRM Online
aspx page or webservice under ISV folder using MSCRM’s vdir
Prepend org name to the page – http:<crmserver>/orgname/isv/page.aspx
Do not prepend org name to the page. URLs are of the format:
aspx page or webservice not under MSCRM’s vdir (on a separate vdir or server for example)
Do not prepend.
Do not prepend
Do not prepend org name.
ISV Menu/Iframe to a URL addressable CRM form
Prepend org name
Do not prepend orgname
Do not prepend orgname
You will notice that you will have to prepend the orgname to the URL if your page is under the ISV folder in MSCRM’s vdir (for on-premise deployments). This is because the MSCRM virtual path provider will process the request to your page and it will assume the request is for the default organization for that user if an orgname is not specified and can result in “The organization id of the user being verified does not match the organization id of the execution context passed to VerifyUser” error.
Michael Höhne has a more detailed blog explaining the authentication issue at: http://www.stunnware.com/crm2/topic.aspx?id=js28
Important note: We will soon be documenting an API (prependOrgName) that can be used in client side scripts to adjust a given URL automatically. We’ll have a blog announcing this in the CRM team blog as soon as the documentation is ready (next round of SDK documentation update will be around end of august).
The CRM SDK documentation also has walkthroughs on how to use discovery service to get the URL to access MSCRM webservices — http://msdn.microsoft.com/en-us/library/bb955359.aspx