JS using context.getServerUrl()

Every now and then I get stuck on something where I didn’t pay enough attention when I was reading the documentation. This is one of those cases.

I was just playing with some OData scripts, and moving from one machine to another I realized that my calls were prompting for re-authentication on one of the machines.

Anyways, I go back to the documentation, which by the way is here, and one of the notes states:

“If you access the server locally using http://localhost or use an IP address rather than the actual name of the server, this will not be reflected in the value returned by this function. This means that if you are making web service calls or accessing web resources, Internet Explorer will apply security settings that apply to requests that cross domains. To avoid this, always connect to Microsoft Dynamics CRM using the standard URL.”

Interesting. There’s some work-around posts online, one of them being the use of document.location.

Just in case, if you ever find that users get prompted for authentication when running an OData call, that should probably be the first place to check.



Leave a Reply

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 )

Facebook photo

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

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: