2011-11-03 43 views
1

在我的應用程序中,我正在上傳文件名中包含瑞典語字符的文件。它工作正常。 但是,當我嘗試下載它,我得到一個錯誤:「一個無效字符在郵件標題中找到」 ..Could你幫對此 請看看我的代碼在文件名中下載具有國際字符的文件

public ActionResult Download(Guid id) 
{ 
    var attachment = AttachmentService.GetAttachmentById(id); 
    var cd = new ContentDisposition 
       { 
        FileName = Utility.GetCleanedFileName(((FileAttachment)attachment).FileName), 
        Inline = false, 
       }; 

    var file = File("\\App_Data" +((FileAttachment)attachment).FilePath, "Application"); 

    Response.ClearHeaders(); 
    Response.Clear(); 
    Response.ContentType = file.ContentType; 
    Response.AppendHeader("Content-Disposition", cd.ToString()); 

    var filePath = "\\App_Data" + ((FileAttachment) attachment).FilePath; 

    Response.WriteFile(filePath); 
    Response.End(); 

    return file; 
} 
+1

你能提供一個文件名的例子嗎?您還正在測試哪個瀏覽器? –

回答

相關問題