views:

39

answers:

1

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?

+1  A: 

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?

David Hoerster
Thanks for that D Hoerster - I have managed to get my javascript to call my webservice and return xml to me. So I am very pleased - they do share the same host and protocol - not sure about the port, but I suspect they are the same.
Vidar
Glad I could help!
David Hoerster