采取下面方式下载时,文件名称长度最长为16个汉字,如果超长下载时会自动载取,请教该如何?????strFileName:下载的文件名称
strFilePath:下载的文件路径Response.AddHeader("Content-Disposition", "attachment; filename=" +
Server.UrlEncode(strFileName) );
Response.AddHeader("Content-Length",aFileInfo.Length.ToString());
Response.Charset = "UTF-8";
Response.ContentType = "application/octet-stream";
//输出文件
Response.WriteFile(strFilePath);
Response.Flush();
Response.End();
strFilePath:下载的文件路径Response.AddHeader("Content-Disposition", "attachment; filename=" +
Server.UrlEncode(strFileName) );
Response.AddHeader("Content-Length",aFileInfo.Length.ToString());
Response.Charset = "UTF-8";
Response.ContentType = "application/octet-stream";
//输出文件
Response.WriteFile(strFilePath);
Response.Flush();
Response.End();
解决方案 »
- 怎么在table里每显示2列数据就换一行怎么弄
- String s ="S1"分配了几次内存,String s="S1"+"s2"分配了几次?
- 新手求教login控件的登陆实现问题
- C#无刷新回调,回传中文出现乱码,加急,分不够加之!~~~~
- ASP.NET中如何添加"框架"?请教高手呀,新手想学习实在在难了!!!!!
- vs 2003 出了问题,等高手解决!!!
- 我的智能查询系统,与大家分享!
- asp.net中有办法让checkbox选中之后就触发事件吗?
- 求教:带有树状下拉框的查询思路
- 我想在DateGrid里面生成的<tr>里面加onMouseOver和onMouseOut这两个属性,应该怎么加,多谢
- 请教ToString的字符格式化问题
- 我的DataGrid的数据源是SqlDataReader,DataGrid自定义分页已经设置了VirtualItemCount,为什么点击分页按钮的时候页面不切换,总是显示
{
FileInfo DownloadFile = new FileInfo(FullFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
Response.ContentType="application/octet-stream";
Response.AppendHeader("Content-Disposition","attachment;filename=" +HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
}
我一直都用这个,你试试!