关于文件下载的问题!下面这段代码为什么在执行时文件总被浏览器直接打开,而不提示下载呢?高分求救!急,谢谢!代码如下:
string createPath = Server.MapPath("../CardAdmin/file/CardCreate" + this.txtbxBatchNO.Text +".txt");
FileInfo DownloadFile = new FileInfo(createPath);
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.UTF32));
Response.AppendHeader("Content-Length ", DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();