2

我尝试通过对文件名应用编码但仍然在response.BinaryWrite(data);

下面是我的代码:

                    WebClient req = new WebClient();
                    HttpResponse response = HttpContext.Current.Response;
                    response.Clear();
                    response.ClearContent();
                    response.ClearHeaders();
                    response.Buffer = true;
                    response.AddHeader("Content-Disposition", "attachment;filename=\"" + XSSSec.Encoder.HtmlEncode(FileName) + "\"");
                    byte[] data = req.DownloadData(FilePath);
                    response.BinaryWrite(data);
                    Response.Flush();
                    Response.SuppressContent = true;

有什么建议可以解决这个问题吗?

4

0 回答 0