CORS endpoints on asp.net Webforms [WebMethod] endpoints

后端 未结 6 1127
北海茫月
北海茫月 2021-01-04 06:47

I am trying to add some [WebMethod] annotated endpoint functions to a Webforms style web app (.aspx and .asmx).

I\'d like to annotate those endpoints w

6条回答
  •  执念已碎
    2021-01-04 07:03

    You can do like this in MVC

    [EnableCors(origins: "*", headers: "*", methods: "*")]
    public ActionResult test()
    {
         Response.AppendHeader("Access-Control-Allow-Origin", "*");
         return View();
    }
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题