tags:

views:

266

answers:

1

I have a page fetching HTML content from a WCF REST service via AJAX. I started seeing errors on IE to the effect that "This page is accessing information that is not under its control...". For some content, the WCF service will, instead of returning the content directly, return instead an object or iframe tag pointing back to itself with different parameters. The WCF service sees a different URL than was requested, and the discrepancy causes the "security" error as IE thinks it's loading content from a different domain.

So, for example, the XHR request asked for

"http://localhost/Services/Content.svc?id=123..." or even "http://mymachine/Services/Content.svc?id=123..."

As soon as the request reaches the WCF service, however, the URL is turned into:

"http://mymachine.mydomain.com/Services/Content.svc?id=123..."

How can I get the originally requested URL within the WCF service? I've inspected theWebOperationContext.Current.IncomingRequest.UriTemplateMatch properties to no avail, there is no remaining trace of "localhost". I've also looked at the following posts and still cannot find the original URL:

http://stackoverflow.com/questions/444010/what-is-the-wcf-equivalent-of-httpcontext-current-request-rawurl

http://jstawski.com/archive/2008/05/01/wcf-wsdl-location-address-with-https.aspx

Is there any way to get to it?