PDF File Corrupt

G

Guest

Hi,

I'm running this code to open a stream as pdf file:
Response.ContentType = "application/pdf";
try
{ mystream = someStream....;
byte[] myfile = mystream.ReadBytes((int)someStreamLenght);
myfile.Length.ToString();
Response.BinaryWrite(myfile);
}
finally
{
Response.Flush();
Response.Close();
mystream.Close();
}
but I run it in a 3 different machines it's telling me that the file is
corrupt or damaged.
and when running it in different machine that have the latest Acrobat 8.0
the document is opening fine!!!?
is this an issue with ASP? because I running VS 2005.

Cheers.
 
M

Mark Fitzpatrick

If this code is behind an .aspx page, make sure there isn't anything in the
actual .aspx design surface. You can have the page directive and such, but
you can't have the html elements or anything else. I find making sure that
you don't have any spaces there either it helps, just the page directive and
any references or other directives and nothing else.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top