zepot post沒有問題,用plupload上傳出現了這個錯誤,options過不去。顯示Response for preflight has invalid http status code 405post
在global中處理下optionspa
protected void Application_BeginRequest() { if (Request.Headers.AllKeys.Contains("Origin") && Request.HttpMethod == "OPTIONS") { Response.End(); } }
另外,還要注意header的設定。多個容許的自定義header逗號隔開。否則也會被拒絕。code
<httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> <add name="Access-Control-Allow-Headers" value="Content-Type,Token" /> <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" /> </customHeaders> </httpProtocol>