我如何 return header 内容从 webapi 到 AngularJS $http 服务

how i can return the header content from webapi to AngularJS $http service

我想 return 来自 webapi 的内容 headers

httpResponseMessage.Content = new ByteArrayContent(bytes.ToArray());
httpResponseMessage.Content.Headers.Add("x-filename", fileName);
httpResponseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
httpResponseMessage.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
httpResponseMessage.Content.Headers.ContentDisposition.FileName = fileName;

并且我想 return 此内容 headers 到 angularjs $http 服务作为

$http.get(...).then(function(response){..})

我正在使用 AngularJS 1.6,但之前在 AngularJS 1.3 中,它工作正常,通过使用 $http.get(...).success 但是现在它是 AngularJS 1.6,它不工作,我无法在我的项目中使用 angularjs 1.3,因为它已经是 1.6,所以请帮助我,如何获取内容 header 数据从 webapi 到 angularjs $http 服务

是cross-domain请求吗?如果是,您是否尝试过公开自定义 headers?

httpResponseMessage.Content.Headers.Add("Access-Control-Expose-Headers", "x-filename");