服务端下载程序,第一次点下载总是出现下载当前网页问题?以后就不会出现了,好奇怪啊!Context.Response.Clear();
FileStream fileStream=new FileStream(Server.MapPath("file_id.diz"), System.IO.FileMode.Open,
System.IO.FileAccess.Read,System.IO.FileShare.Read);
long fileSize = fileStream.Length;
Context.Response.ContentType="application/octet-stream";
Context.Response.AddHeader("Content-Disposition","attachment; filename=file_id.diz");
Context.Response.AddHeader("Content-Length",fileSize.ToString());
byte[] fileBuffer=new byte[fileSize];
fileStream.Read(fileBuffer, 0, (int)fileSize);
Context.Response.BinaryWrite(fileBuffer);
Context.Response.End();
Context.Response.ContentType = "text/html";
FileStream fileStream=new FileStream(Server.MapPath("file_id.diz"), System.IO.FileMode.Open,
System.IO.FileAccess.Read,System.IO.FileShare.Read);
long fileSize = fileStream.Length;
Context.Response.ContentType="application/octet-stream";
Context.Response.AddHeader("Content-Disposition","attachment; filename=file_id.diz");
Context.Response.AddHeader("Content-Length",fileSize.ToString());
byte[] fileBuffer=new byte[fileSize];
fileStream.Read(fileBuffer, 0, (int)fileSize);
Context.Response.BinaryWrite(fileBuffer);
Context.Response.End();
Context.Response.ContentType = "text/html";
Context.Response.ContentType = "text/html";放到前面去,不要放在最后面