Q:

$http: how to get filename of headers from WebApi with CORS

I get issue that I can't get filename from headers of $http response

HTTP/1.1 200 OK
  Content-Length: 121257
  Content-Type: application/pdf
  Server: Microsoft-HTTPAPI/2.0
  Access-Control-Allow-Origin: *
  Access-Control-Expose-Headers: *
  Content-Disposition: attachment; filename=Order-414.pdf
  Date: Wed, 11 Feb 2015 05:32:25 GMT  

I just want to get filename (Order-414.pdf) as pdf name when downloading.  but in this code block:
   $http.get(httpPath, { responseType: 'arraybuffer' })
            .success(function (data, status, headers) {
                debugger;
                // just return content-type
                var header = headers();

header object just contains content-type. 
Object {content-type: "application/pdf"}

I read somewhere that we need config CORS for WebAPI as:
  private static void RegisterCorsConfig(HttpConfiguration config)
    {
        var cors = new EnableCorsAttribute("*", "*", "*", "*");
        //var cors = new EnableCorsAttribute("*", "*", "*", "DataServiceVersion, MaxDataServiceVersion");
        //cors. ExposedHeaders. Add("*");
        //cors. ExposedHeaders. Add("filename");
        config. EnableCors(cors);
    }

But it still doesn't work.  Please help me. 
Thanks in advance. 

A:

I suppose you need to add Content-Disposition instead of filename into Access-Control-Expose-Headers
cors. ExposedHeaders. Add("Content-Disposition");

