下载后,打开的文件,提示格式出错? Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.Buffer = true;
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AppendHeader(@"Content-Disposition", @"attachment;filename=" + HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", (strFiledata.Length).ToString());
Response.ContentType = strContentType;
Response.OutputStream.Write(strFiledata, 0, strFiledata.Length);
Response.Flush();
Response.End();asp.netdocx
Response.ClearHeaders();
Response.ClearContent();
Response.Buffer = true;
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AppendHeader(@"Content-Disposition", @"attachment;filename=" + HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8));
Response.AddHeader("Content-Length", (strFiledata.Length).ToString());
Response.ContentType = strContentType;
Response.OutputStream.Write(strFiledata, 0, strFiledata.Length);
Response.Flush();
Response.End();asp.netdocx
byte[] bytes = new byte[1024];
int count = 1;
try
{
while (count > 0)
{
count = stream.Read(bytes, 0, bytes.Length);
fileStream.Write(bytes, 0, count);
}