我在网页上搞了一个表格,每行中有一个下载按钮,多点几次下载按钮以后会出现页面乱码,下载的代码如下: Response.ContentType = "application/x-download";
Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.TransmitFile(file);
Response.Flush();服务器是win2003很奇怪,前几次都可以,下载几次后就乱码了
Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.TransmitFile(file);
Response.Flush();服务器是win2003很奇怪,前几次都可以,下载几次后就乱码了
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
改一下试试,乱码问题一般就是这两个地方
的上面加上Response.Charset="gb2312";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");根据你的内容编码而定,如果是utf-8,则改为
Response.Charset="utf-8";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");试试看
在我朋友的电脑上(Win2000)就会出问题
Response.End();