how to get around cors policy api code example

Example 1: how to enable cors policy in web api

BY LOVE
To enable CORS policy in web api, You need to add this method in your Global.asax file of API project. i.e
        
        protected void Application_BeginRequest()
        {
            HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
        }

Example 2: what is cors

“CORS” stands for Cross-Origin Resource Sharing. 
It allows you to make requests from one website to another website 
in the browser, which is normally prohibited by another browser policy 
called the Same-Origin Policy (SOP).