Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("Content-Disposition", "inline; filename=Test.pdf");
FileStream fs = new FileStream(filename, FileMode.Open);
long fileSize = fs.Length;
byte[] bBuffer = new byte[System.Convert.ToInt32(fileSize)];
fs.Read(bBuffer, 0, System.Convert.ToInt32(fileSize));
fs.Close();
Response.BinaryWrite(bBuffer);
Response.Flush();
Response.Close();
No comments:
Post a Comment