首先描述下问题:需求是在请求头中加入token,我在ajax请求数据时添加了请求头‘Authorization’字段,并添加了响应的token值,在请求数据的时候浏览器报错如下: Request header field Authorization is not allowed by Access-Control-Allow-Headers 解决办法就是让后台将‘Authorization ’添加到‘Access-Control-Allow-Headers’中. 后来查资料发现问题跟跨域请求有关
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using System.Web.Http; using System.Web.Http.Controllers; namespace Common { public clas