Chrome ignoring the extension suggested in the Content-Disposition header of an HttpResponse sent from a WebAPI controller
<p>I'm trying to write a WebAPI controller that generates a Windows shortcut file (.lnk) on the fly and sends it back to the client, but even when I'm specifying ".lnk" as the extension in the Content-Disposition header when building the response, Chrome still changes it to ".download" in the Save As dialog. I've tried with both application/x-ms-shortcut and application/octet-stream as the Content-Type, but it has the same behavior in both cases.</p>

<p>Does anyone know how to avoid this and force it to suggest "Link.lnk" in the dialog?</p>

<p><em>Note 1: I'm using Chrome 47</em>.</p>

<p><em>Note 2: It works fine in IE 11</em>.</p>

<pre><code>var response = new HttpResponseMessage(HttpStatusCode.OK);
var stream = new FileStream(linkPath, FileMode.Open);
response.Content = new StreamContent(stream);

response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = "link.lnk" } ;
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/x-ms-shortcut");
response.Content.Headers.ContentLength = stream.Length;

return response;
</code></pre>