Multisite WebApi


Dear Episerver

I am in a slight corner at the moment with a problem.

the problem is as follows

I have in front of me a multisite ASP.Net MVC application Episerver 7.5

- site1:
- site2:
- site3:
All running on seperate apppools and websites in IIS

Now my task is to implement a webapi in "site2" with basic methods (get,post)

After creating the webapi and routing init etc, and ran the application,

To my surprise the webapi is only available on "site1" and if i try and call the webapi from an ajax call inside "site2" i get : => with result in =>
XMLHttpRequest cannot load No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access. => with result in =>

now this happens when we are posting from a seperate domain, but this suggestes that the webapi routing is bound only with "site1",
and thats why its not availabe on

i guess my question is, how do i bind the webapi to rather than the default

Nov 25, 2015 18:32

You should be able to do this by adding an header similar to this inside your web-api:

ControllerContext.Request.Headers.Add("Access-Control-Allow-Origin", "*");
Nov 26, 2015 8:34

Thanks for the Reply, i wonder if there is a way to choose what site i can bind the Web Api to, perhapse some missing interface implementation, config etc

i might be wrong, but i think i should not have to specify the access control if all my sites are running on the same application and share the same controllers.

Nov 26, 2015 9:34
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.