c# Access to XMLHttpRequest at from origin has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. code example

Example: 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", "*");
        }