production vs dev server content-disposition filename encoding

Posted by rgripper on Stack Overflow See other posts from Stack Overflow or by rgripper
Published on 2012-10-18T12:54:55Z Indexed on 2012/10/18 17:02 UTC
Read the original article Hit count: 321

I am using asp.net mvc3, download file in the same browser (Chrome 22). Here is the controller code:

[HttpPost]
public ActionResult Uploadfile(HttpPostedFileBase file)//HttpPostedFileBase file, string excelSumInfoId)
{
    ...
    return File(
        result.Output,
        "application/vnd.ms-excel",
        String.Format("{0}_{1:yyyy.MM.dd-HH.mm.ss}.xls", "????????????", DateTime.Now));
}

On my dev machine I download a programmatically created file with the correct name "????????????_2012.10.18-13.36.06.xls".

Response:

Content-Disposition:attachment; filename*=UTF-8''%D0%A1%D1%83%D0%BC%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5_2012.10.18-13.36.06.xls
Content-Length:203776
Content-Type:application/vnd.ms-excel
Date:Thu, 18 Oct 2012 09:36:06 GMT
Server:ASP.NET Development Server/10.0.0.0
X-AspNet-Version:4.0.30319
X-AspNetMvc-Version:3.0

And from production server I download a file with the name of the controller's action + correct extension "Uploadfile.xls", which is wrong.

Response:

Content-Disposition:attachment; filename="=?utf-8?B?0KHRg9C80LzQuNGA0L7QstCw0L3QuNC1XzIwMTIuMTAuMTgtMTMuMzYu?=%0d%0a =?utf-8?B?NTUueGxz?="
Content-Length:203776
Content-Type:application/vnd.ms-excel
Date:Thu, 18 Oct 2012 09:36:55 GMT
Server:Microsoft-IIS/7.5
X-AspNet-Version:4.0.30319
X-AspNetMvc-Version:3.0
X-Powered-By:ASP.NET

Web.config files are the same on both machines.

Why does filename gets encoded differently for the same browser? Are there any kinds of default settings in web.config that are different on machines that I am missing?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-3

Related posts about google-chrome