Microsoft has launched VSCode few weeks back for Cross Platform (Linux/Mac,Windows) and 55% download was Non-Windows. Shocking , right ?
HackerNews had a post on this and had really lot of comments/traffic on it.
Lets see the first look of Code.
Cross-site HTTP requests are HTTP requests for resources from a different domain than the domain of the resource making the request. For instance, a resource loaded from Domain A (http://domaina.example) such as an HTML web page, makes a request for a resource on Domain B (http://domainb.foo), such as an image, using the img element (http://domainb.foo/image.jpg). This occurs very commonly on the web today — pages load a number of resources in a cross-site manner, including CSS stylesheets, images and scripts, and other resources.
As an example –
If my Server is in http://www.shahjada.com and my client (which is hosted at http://www.shahjada-talukdar.com) calls that Server with an AJAX GET , it will give an error for Cross Domain Issue .
If the Client and Server is in the same server but in different port , It will also give Cross Domain error . Only if Client and Server are in same Address , it will work nicely.
Suppose , My ASP.net MVC WebAPI is hosted at http://www.shahjada-talukdar.com and my client is in http://www.shahjada.com , It will throw the error .
We can fix this issue by Using Cross Origin Resource Sharing (CORS) in ASP.NET Web API Server .
For that , We can create a CORS handler and add that handler to GlobalCOnfiguration’s MessageHandler .
My Cors handler is something like this :
Now Add that to Global.asax.cs like below :
Now our Server is ready to handle any Cross Domain Client’s Call .