关于中文附件名称的问题 请教各位大大,小第把附件存在数据库中,用户点击链接下载附件时,原来很长的中文文件名一律都变成16个中文了,163的附件下载似乎没有这个限制,请问各位大大该如何解决 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 设置web.config中:<globalizationrequestEncoding="gb2312" responseEncoding="gb2312"/> 我是把存在数据库里的文件先变成文件流然后存成一个临时文件,然后跳转到这个文件,它就会弹出一个下载的对话框代码:FileStream fs =new FileStream(MapPath("temp/"+dr.GetString(1).ToString()),FileMode.Create); fs.Read(Buffer,0,Buffer.Length); fs.Close(); Response.Redirect("temp/"+dr.GetString(1).ToString()); 可是Response.Redirect以后原来很长的中文文件名就变成只有16个中文字了 试试Server.UrlEncode和Server.UrlDecode try{if(conn.State==ConnectionState.Closed)conn.Open();SqlDataReader dr=cmd.ExecuteReader();while(dr.Read()){HttpContext.Current.Response.Buffer=true;HttpContext.Current.Response.Clear();HttpContext.Current.Response.ContentType=dr["filetypes"].ToString();HttpContext.Current.Response.AddHeader("Content-Type",dr["filetypes"].ToString());HttpContext.Current.Response.AddHeader("Content-Disposition","attachment;filename="+HttpUtility.UrlEncode(dr["fileName"].ToString())+";");HttpContext.Current.Response.BinaryWrite((byte[])dr["filecontent"]);HttpContext.Current.Response.Flush();HttpContext.Current.Response.End();}}catch{throw;}finally{conn.Close();} 保存时没有被截断,是IE的问题,似乎IE会把字符截取,但163邮箱的附件可以不知道为什么 跪求解答---后台页面获取不到服务器控件地值 datalist如何实现有1,2,3,4这样的分页? 在中怎么向另一页面传递多个数值? HTTP接口短信发送 请问在owc图表中如何把y轴去掉?谢谢!!! 我是先学习还是先找工作? C# .net 如何预览tif文件 web自定义控件中的事件问题. 在服务器端传回一个TREEVIEW,能在WEB端接受并显示吗? asp.net 4.5 cookie 跳转页面后丢失 谁能给俺说说wmi是啥啊? 初学Asp.net 在按F5进行调试时,提示,无法开始调试,无法找到IE,请问这是什么问题
<globalization
requestEncoding="gb2312"
responseEncoding="gb2312"
/>
代码:
FileStream fs =new FileStream(MapPath("temp/"+dr.GetString(1).ToString()),FileMode.Create);
fs.Read(Buffer,0,Buffer.Length);
fs.Close();
Response.Redirect("temp/"+dr.GetString(1).ToString());
{
if(conn.State==ConnectionState.Closed)
conn.Open();
SqlDataReader dr=cmd.ExecuteReader();
while(dr.Read())
{
HttpContext.Current.Response.Buffer=true;
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ContentType=dr["filetypes"].ToString();
HttpContext.Current.Response.AddHeader("Content-Type",dr["filetypes"].ToString());
HttpContext.Current.Response.AddHeader("Content-Disposition","attachment;filename="+HttpUtility.UrlEncode(dr["fileName"].ToString())+";");
HttpContext.Current.Response.BinaryWrite((byte[])dr["filecontent"]);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.End();
}
}
catch
{
throw;
}
finally
{
conn.Close();
}