The WordPress.com stats helper prepared a 2015 annual report for this blog.
Here’s an excerpt:
The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 34,000 times in 2015. If it were a concert at Sydney Opera House, it would take about 13 sold-out performances for that many people to see it.
Click here to see the complete report.
In modern web applications developers mostly use any client side frameworks like AngularJS, EmberJS, Knockout etc. and in order to make server-side request they either call a Web API or a web service through XMLHttpRequest object and perform CRUD operations.
So for example if the application URL is http://localhost/WebApplication and it is calling http://localhost:8089/WebService it will fail and give cross-origin request issue.
In internet explorer it ignores the port no. so if both are on localhost or same base address it will call it without any issue. But this does not solve the case. In order to develop a service or a Web Api that has to be accessed by any client we need to handle it properly.
In this post, I will show how simply with few steps we can enable Cross Origin Resource sharing in ASP.NET Web Api.
- First of all in your Web API project add a NuGet Package “Microsoft.AspNet.WebApi.Cors” through NuGet Package Manager
- Then in the WebApiConfig.cs class add an entry to enable cors.
- And finally add the EnableCors attribute on Controller and specify the allowed origins, headers and methods
- You can set origin, header and methods as below.
Hope this helps!