0

I've got a strange problem here: in an ASP.NET controller I do that:

    public ActionResult ExportTex()
    {
        Response.ContentType = "text/plain";
        Response.AddHeader("Content-Disposition", "attachment;filename=\"" + Server.HtmlEncode("overview.tex") + "\"");
        return View(_model);
    }

which should make my browser (FireFox 17) open file download dialog and use the corresponding filename for the download. The filename however always gets the extension ".sdx" appended in addition to the provided extension .tex no matter how I name the file in the Content-Disposition header (i.e. the file is named overview.tex.sdx when downloaded via FireFox).

I'd be very grateful if somebody could explain to me where this additional extension comes from.

Only FireFox is behaving this way. Chromium instead works like a charm.

//edit As requested, here's what headers FireFox gets:

X-SourceFiles:=?UTF-8?[... doesn't matter I guess]?=
X-Powered-By:ASP.NET
X-AspNetMvc-Version:4.0
X-AspNet-Version:4.0.30319
Vary:Accept-Encoding
Set-Cookie:.ASPXROLES=; expires=Mon, 11-Oct-1999 22:00:00 GMT; path=/; HttpOnly
Server:Microsoft-IIS/8.0
Date:Sat, 24 Nov 2012 15:13:40 GMT
Content-Type:text/plain; charset=utf-8
Content-Length:7975
Content-Encoding:gzip
Content-Disposition:attachment;filename="overview.tex"
Cache-Control:private, s-maxage=0
Hendrik Wiese
  • 2,010
  • 3
  • 22
  • 49

1 Answers1

0

That is indeed strange, as Firefox isn't supposed to do content type sniffing if the content type is "text/plain; charset=utf-8".

Can you reproduce this on multiple machines? What platform? If Windows, do you have any software installed that handles "sdx" (search the registry...).

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98
  • Oh, you edited your answer... I've just noticed. Umh, yes, there is this Secure Download Manager or whatever it is called that Microsoft uses to provide access to Dreamspark downloads. It is associated with the SDX extension. Regarding reproducibility, I haven't tried it on another machine yet. I'm gonna do that later today and keep you informed. – Hendrik Wiese Dec 10 '12 at 09:55
  • Strange thing is, apparently since I've installed Windows 8 (or an update of FF that I haven't even noticed) it works. Firefox isn't appending the SDX extension anymore. Really weird. Well, doesn't matter. Problem (dis-)solved! – Hendrik Wiese Dec 10 '12 at 10:04