Hi,
I have a telerik page pageX.aspx working fine on
www.x.co.uk/pageX.aspx
Now, for certain reasons I would like to reuse this page but with the url on a subdomain as -
sub.x.co.uk/pageX.aspx
I am using Host Headers and URL rewriting to make the call to PageX.aspx from both urls (but using the same code base).
I use a base href of
<base href="http://www.x.co.uk/" />
as part of my URL Rewriting
Now, The www URL works fine ./
But I get (or equivalent)
Message: Access is denied.
Line: 6
Char: 63059
Code: 0
URI: http://www.x.co.uk/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-GB%3afab31106-1bd6-4491-9a14-59e0fc4a7081%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%3aen-GB%3abd09f19b-b595-4ea4-8ab8-449a745bc83c%3a16e4e7cd%3af7645509%3a22a6274a%3a24ee1bba%3af46195d3%3a874f8ea2%3a19620875%3a39040b5c%3af85f9819%3a490a9d4e%3abd8f85e4
when loading up the sub.x.co.uk/pageX.aspx
Could you please advise me on why this is happening (obviously something to do with x-domain access from sub to www) and what I can do to rectify this asap?
Many Thanks
Matt
7 Answers, 1 is accepted

Any help on this please?
Do I need to provide more information?
Thanks
Matt
This problem might occur if an AJAX request from sub.x.co.uk is sent to www.x.co.uk. A cross-domain restrictions apply for sub-domains as well. A possible work-around for this is to set the document.domain to the main domain, e.g.:
document.domain =
"x.co.uk"
;
Another possible solution to this case is to use WebProxy for AJAX requests - please review the following article for more detailed information on the subject:
http://developer.yahoo.com/javascript/howto-proxy.html
Best wishes,
Dobromir
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Hi Dobromir,
Thanks for your reply, just getting my head around the issues I may face and your help is appreciated.
I have set document.domain = "x.co.uk" in the <head> of all pages in the application as you suggest, which should allow all my domains within x.co.uk to talk to each other? to no avail at present, but ...
With regards to telerik and the access denied - I am using these controls in the page itself
<telerik:RadToolTipManager ID="deliveryRadToolTipManager" Visible="false" runat="server"
EnableShadow="true" Position="BottomCenter" Animation="Slide" ShowDelay="500"
HideDelay="3000" Width="415px" RelativeTo="Element">
<WebServiceSettings Method="StoreInfoPopUp" Path="http://www.x.co.uk/services/UCHtmlWebService.asmx" />
</telerik:RadToolTipManager>
(was using ~/services/ above but thought would make it explicit)
and in my master page -
<telerik:RadScriptManager OutputCompression="AutoDetect" ID="RadScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
<asp:ScriptReference Path="jspacked/jsall.packed.js" />
</Scripts>
</telerik:RadScriptManager>
<telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
</telerik:RadStyleSheetManager>
The page loads fine (no errors), but when I activate the popup which calls the asmx web service on a sub domain I get the access denied error.
Is assume this is because I cannot call a x-domain asmx web service via javascript from the telerik control (as per standard security even though I have document.domain workaround in there)? could you help confirm this to me and if there is any workarounds you are aware of?
In the meantime I will try and URLRewrite the service call so it looks like telerik is pointing to http://sub.x.co.uk/services/UCHtmlWebService.asmx (I think this would help)
Is there anything else which I might need to rewrite for telerik so its looks like it is pointing to the subdomain?
Any other suggestions welcome?
Many Thanks
Matt
The problem you face comes from the different domains. This is an inherent limitation of the XmlHttpRequest object that is used to query the web service. There are workarounds like JSONP that allow for cross-domain calls, but it will require extensive modifications to both the web service and the client-side code. Here's an example:
http://www.codeproject.com/KB/webservices/ASPNET_JSONP.aspx
Another alternative is to use server-side proxy service to redirect the request to the actual web service:
http://msdn.microsoft.com/en-us/library/ms155134.aspx
To summarize - if you define the web service resource using http, i.e. specifying the protocol, or use a web-service from a different domain, you are most likely to stumble upon this. Therefore you best option is to stick with the "~/services" syntax.
Hope this helps.
Kind regards,
Niko
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

I have now rewritten the asmx URL so it looks like this -
<telerik:RadToolTipManager ID="deliveryRadToolTipManager" Visible="false" runat="server"
EnableShadow="true" Position="BottomCenter" Animation="Slide" ShowDelay="500"
HideDelay="3000" Width="415px" RelativeTo="Element">
<WebServiceSettings Method="StoreInfoPopUp" Path="http://sub.x.co.uk/services/UCHtmlWebService.asmx" />
</telerik:RadToolTipManager>
Should this theoretically work as all in the same domain?
If so, I will try stripping the page down to just this call + code dependants and go from there?
Thanks
Matt
In order to avoid the JSONP service request the domain the page is served from should exactly match the domain of the service, this includes exact matches in the sub-domain as well.
Here is a short example - you serve your page from http://x.co.uk/, however you wish to execute the service from http://sub.x.co.uk/. Since the domains do not match, i.e. "x.co.uk" != "sub.x.co.uk", the service invoker will try to call a JSONP request. Therefore you should try to call your service through x.co.uk or serve the site from sub.x.co.uk.
Finally, using the "~/services/..." syntax will result in using the currently executing domain, which will eliminate any doubts if the web service will work.
Hope this explanation was complete and accurate enough.
All the best,
Niko
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Thats clear, I would like to keep this thread open whilst I develop this going forward and will come back as it progresses.
Thanks
Matt