📜  如何在 web api 中启用 cors 策略 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:11.138000             🧑  作者: Mango

代码示例1
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", "*");
        }