Last post Mar 02, 2007 02:37 PM by Olly
Sep 29, 2006 08:53 PM|TommyGunn|LINK
Hi, I've posted a few times about reading PDFs from SQL. Now i"m just trying to display it from a file.
This article says it's Possible, but I'm still getting a blank page when I do it. Same code, just C sharp.
Response.ContentType = "application/pdf";
string FilePath= Server.MapPath("PDFs/hey.pdf");
Any reason this wouldn't be working? The file is where it is supposed to be.
Sep 30, 2006 04:20 AM|EssaiMeilleur|LINK
Oct 05, 2006 11:58 AM|Haissam|LINK
testing it and it worked.
in my mind there are two ways to solve it
First, make sure that the FilePath is returning the correct file path on the server using the command window and breakpoints print it's value.
Second.. try to add below FilePath variable this
string EncodedFilePath = Server.UrlEncode(FilePath);
and add this Response.WriteFile(Server.UrlDecode(FilePath));
Mar 02, 2007 02:37 PM|Olly|LINK
I’m amazed that this is working for you guys, cause it wasn’t for me. As long as I had the
statement after the
the page quit before the user was even able to click the “download file” button leaving the user with an empty page or nothing (depending
on the browser)
You can find my code here:
pop up to open word document