Hi,
We recently faced an issue after we configured our CRM 2011 site for SSL\HTTPS.
While using context.getServerUrl() method in our web resources we were getting the url value having http instead of https. And the other issue that we regularly faced was the Access Denied one if we access our CRM server either through localhost or through IP address.
These two wonderful posts talk about how to deal with these issues
http://social.microsoft.com/Forums/is/crmdeployment/thread/dc35f48d-f528-44ee-91b5-73b6c42e6217
http://myencounterwithcrm.wordpress.com/2011/05/24/crm-2011-alternative-to-context-getserverurl/
getServerUrl() method returns the url according to the configured values in the Deployment Manager, not based on the url you have used to navigate to the page
and using
var customServerURL = document.location.protocol + “//” + document.location.host +“/” + Xrm.Page.context.getOrgUniqueName();
Update : It works for on premise scenario only
Check this most helpful post on how to get the server url
http://danielcai.blogspot.com/2012/02/get-right-server-url-in-your-crm-client.html
Hope it helps
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

It doesn’t work in case of IFD deployment. In case of IFD our URL is constructed as https://OrganizationName.crm.dynamics.com or https://OrganizationName.DomainName.com. do you have any solution that will work in both IFD and Online without IFD configured.
LikeLike
It’s not my first time to pay a visit this website, i am visiting this web site dailly and take pleasant information from here everyday.
LikeLike
Hello colleagues, good article and pleasant urging commented here, I am actually enjoying by these.
LikeLike