November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
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", "*.site2.com");
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.
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
Example:
- site1: local.site1.com
- site2: local.site2.com
- site3: local.site3.com
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 :
http://local.site1.com/api/test/post?a=26643&b=26657 => with result in =>
XMLHttpRequest cannot load http://local.site1.com/api/test/post?a=26643&b=26657. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://local.site2.com' is therefore not allowed access.
http://local.site2.com/api/test/post?a=26643&b=26657 => with result in =>
404
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 local.site2.com rather than the default local.site1.com.