Question

If I have a WCF SOAP (C#) based web service running in my local IIS - and I make an ASP.net website, again running in my local IIS - will the javascript making HTTP request calls from my webpage be successful? Or do the same origin policy rules come into play here?

Was it helpful?

Solution

It depends on how your sites are configured in IIS. Check out this wikipedia article on same origin policy.

Let's say your WCF SOAP service is running on http://localhost/service/GetStuff.svc and your ASP.NET site is running on http://localhost/mysite/Default.aspx. According to the table in the same origin article, the call should succeed, since your server host is the same in both cases (localhost) and differ only on the directory being referenced.

But, if your WCF SOAP service is running on http://localhost:8080/service/GetStuff.svc and your ASP.NET site is running on http://localhost/mysite/Default.aspx (default port of 80), then the call will fail since the server host differs in the port being accessed.

The three things to consider are host, protocol (http or https) and port. According to the article, not all browsers enforce port.

I hope this helps. Good luck!

BTW, does your application work?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top