發表文章

目前顯示的是 11月, 2021的文章

C#WEB API 無法抓取檔名:Refused to get unsafe header “Content-Disposition”

開發檔案下載時,在測試機開發沒問題,上線後卻無法下載檔名。 開發工具顯示錯誤 Refused to get unsafe header "Content-Disposition" 看HTTP回復的資訊是有 Content-Disposition,但是前端始終抓不到,後來查了一下原來API需要增加 response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition"); 這樣子前端才可以抓地到這個欄位喔!!!! Ref:https://dicksonkho.com/software-road/refused-to-get-unsafe-header-content-disposition/#comment-1854