将doc文件输入到内存流中

FileStream fileStream=new FileStream(pFileName,FileMode.Open)
long fileSize = fileStream.Length;
Context.Response.ContentType="application/msword";
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();

你可能感兴趣的:(文件)