Things to consider while using getServerUrl() in CRM 2011

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


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

3 thoughts on “Things to consider while using getServerUrl() in CRM 2011”

Share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s