下载文件名称长度限制 昨天测试了下载文家名称的长度,可是文件名称过长的话(具体是超过17个)就会出现乱码。由于系统的需求文件名称是肯定会超过17个的不知道那位高人指点下了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://blog.csdn.net/hglxr/archive/2008/01/10/2034080.aspxhttp://www.cnblogs.com/bobowu/archive/2005/08/14/214580.html 文件长度超过17没问题,应该是代码问题 string path = Server.MapPath("~/") +""; Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(obj.Name, System.Text.Encoding.GetEncoding("utf-8")) + "." + obj.AttachmentExt);//HttpUtility.UrlEncode if (File.Exists(path)) { Response.ContentType = "application/octet-stream"; Response.WriteFile("" + path + ""); } Response.End(); 对文件名字进行UTF-8编码Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("UTF-8","文件名"); Response.Clear(); Response.ClearHeaders(); Response.Buffer = false; string FileName = System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(_lf.filename)); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(_lf.filename, System.Text.Encoding.GetEncoding("utf-8"))); Response.WriteFile(Server.MapPath("~/LawFile/") + _lf.savename); Response.Flush(); 不是吧 现在csdn的人这么保守吗?都不愿意说?还是没人会 请问读取文章之后的分页应该怎么做?? 使用ISNET出现的问题 超灵异的~~不知道是什么机制~~关于HTML Table .net中cs代码中 获取当前页面的路径 非常奇怪的问题,请高手指教! ASP.NET GridView获取值 请问,我想要从.cs,动态改变 User Control 怎么做呢? 大家好,大家帮帮我吧 关于在.net中附件存取的问题 字符串转换问题,急!!! 求助:如何将SQL数据库的内容导出到EXCEL表格? 有没有用js写的日期时间控件
http://www.cnblogs.com/bobowu/archive/2005/08/14/214580.html
string path = Server.MapPath("~/") +"";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(obj.Name, System.Text.Encoding.GetEncoding("utf-8")) + "." + obj.AttachmentExt);//HttpUtility.UrlEncode if (File.Exists(path))
{
Response.ContentType = "application/octet-stream";
Response.WriteFile("" + path + "");
}
Response.End();
Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode("UTF-8","文件名");
Response.ClearHeaders();
Response.Buffer = false;
string FileName = System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(_lf.filename));
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(_lf.filename, System.Text.Encoding.GetEncoding("utf-8")));
Response.WriteFile(Server.MapPath("~/LawFile/") + _lf.savename);
Response.Flush();