ASP.NET直接下载一个文件,而不是在IE中打开它

FileStream fileStream=new FileStream(pFileName,FileMode.Open)

long fileSize = fileStream.Length;

Context.Response.ContentType="application/octet-stream";

Context.Response.AddHeader("Content-Disposition","attachment; filename=\"" + fileName + "\";");

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();