1
我建立該文件的下載阿賈克斯,但返回的文件名被切斷:MVC 3文件下載切文件名
原文件名:
Toksykologia - wyklady 2010.doc.pdf
瀏覽器下載:
Toksykologia
代碼
HttpResponseBase response = HttpContext.Response;
FileInfo TheFile = new FileInfo(filePath);
response.Clear();
cookie.Value = "success";
response.SetCookie(cookie);
response.Buffer = true;
response.AddHeader("content-disposition", "attachment;filename=" + TheFile.Name);
response.Charset = "";
response.ContentType = "application/pdf";
response.WriteFile(TheFile.FullName);
response.Flush();
response.End();