附件下载功能,在本机测试好用,发布到服务器IIS后失效。
相关代码:string path = S0201_Logic.GetAttachmentByIncident(type, IncidentId);
if (!string.IsNullOrEmpty(path))
{
string filePath = Server.MapPath(path);//路径
FileInfo DownloadFile= new FileInfo(filePath);
if (DownloadFile.Exists)
{
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + ToHexString(DownloadFile.Name));
Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
} }数据库中附件地址格式如下:/upload/2012/8/25/啊啊.xlsx
请问各位可能会是什么原因导致下载失效的呢
相关代码:string path = S0201_Logic.GetAttachmentByIncident(type, IncidentId);
if (!string.IsNullOrEmpty(path))
{
string filePath = Server.MapPath(path);//路径
FileInfo DownloadFile= new FileInfo(filePath);
if (DownloadFile.Exists)
{
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + ToHexString(DownloadFile.Name));
Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
} }数据库中附件地址格式如下:/upload/2012/8/25/啊啊.xlsx
请问各位可能会是什么原因导致下载失效的呢
解决方案 »
- C#中浮点数怎么控制在小数点后两位
- 安装vs2005的问题
- datalist的EditItemTemplate下DropDownList的数据绑定
- 网页初始化问题!
- 在ASP.NET如何制作一个浮动的层,无论是缩放窗口还是拉动滚动条,这个层总是在左边中间位置?
- 文件上传高难度问题。。。。。。。。。。
- 一个PHP和NET的连接问题
- 未将对象引用设置到对象的实例的问题
- System.IndexOutOfRangeException: 索引超出了数组界限
- 同志们我这个SQL查询怎么写?
- 取出文本内容中的第一张图像?
- 问大家一个问题,我一个页面有2个gridview 我任意点击左面的一个gridview中的一行,它会自动到右边的gridview,点击右边的也能过左边的
而不是相对项目调试的~\sss\sss.......