Answered by:
problem with custom aspx page using IFD

Question
-
Hello everybody,
my team and I are developing a custom web application which is going to be part of a MS CRM 4 deployment (in several countries).
It is deployed in a virtual directory inside ISV; it works fine as long as users are inside the domain, because the path to access web pages is like http://SERVERNAME/ORGNAME/PAGE.
When trying to access the application from outside the domain (through IFD) the path becomes http://ORGNAME.SERVERNAME/PAGE.
This way the custom application loses all the references (css, javascripts, subpages, etc.).
We would like the application to work either via domain hosts and IFD.
Anybody had the same issue? Any ideas about how to solve this?Tuesday, August 11, 2009 3:41 PM
Answers
-
Couldn't this be solved by using relative urls and windows.location.hostname?
Best Regards Jens Egil Evensen- Marked as answer by DavidJennawayMVP, Moderator Friday, August 21, 2009 8:48 AM
Tuesday, August 11, 2009 4:10 PM -
Here are a few examples for the above suggestions:
For non-server side code files you can use:
/isv/myapp/_css/main.css
Or
/isv/myapp/_script/main.js
Or
/isv/myapp/_imgs/test.gif
When it comes to referencing server side files like aspx or asmx you should append the organization name to the url e.g.
From an IFRAME <script>Relative: top.prependOrgName(“/isv/myapp/main.aspx”);
or build the url your self
FullPath: location.protocol + “//” + location.host + top.prependOrgName(“/isv/myapp/main.aspx”);
You can also build the url on the server side and render the links appropriately or set the <base> tag to set the entire page base url e.g. <base href=”<%=baseUrl%>”>
In order to get the correct url for ifd and onpremise you can either query the discovery service and get the CrmServiceUrl or parse the request URL and check if it’s IFD e.g. orgname.domain.com or just orgname.
GI CRM Blog * GI Website- Marked as answer by DavidJennawayMVP, Moderator Friday, August 21, 2009 8:48 AM
Wednesday, August 12, 2009 1:30 AM
All replies
-
Couldn't this be solved by using relative urls and windows.location.hostname?
Best Regards Jens Egil Evensen- Marked as answer by DavidJennawayMVP, Moderator Friday, August 21, 2009 8:48 AM
Tuesday, August 11, 2009 4:10 PM -
I'd second that thought - we have exactly that situation and just use relative paths. Our app is relatively simple, so perhaps there's something that makes this approach problematic for you?Tuesday, August 11, 2009 6:43 PM
-
Here are a few examples for the above suggestions:
For non-server side code files you can use:
/isv/myapp/_css/main.css
Or
/isv/myapp/_script/main.js
Or
/isv/myapp/_imgs/test.gif
When it comes to referencing server side files like aspx or asmx you should append the organization name to the url e.g.
From an IFRAME <script>Relative: top.prependOrgName(“/isv/myapp/main.aspx”);
or build the url your self
FullPath: location.protocol + “//” + location.host + top.prependOrgName(“/isv/myapp/main.aspx”);
You can also build the url on the server side and render the links appropriately or set the <base> tag to set the entire page base url e.g. <base href=”<%=baseUrl%>”>
In order to get the correct url for ifd and onpremise you can either query the discovery service and get the CrmServiceUrl or parse the request URL and check if it’s IFD e.g. orgname.domain.com or just orgname.
GI CRM Blog * GI Website- Marked as answer by DavidJennawayMVP, Moderator Friday, August 21, 2009 8:48 AM
Wednesday, August 12, 2009 1:30 AM