Dim Buffer() As Byte
ReDim Preserve Buffer(CInt(FileSize - 1))
MyFileStream.Read(Buffer, 0, CInt(FileSize - 1))
I know you have cut'n'pasted, etc. But humor me (us):
What happens if you don't reduce the file size (Highlighted in red, above). ie Read and Send the Last byte of the PDF?
Also, I know very little about ASP.NET security contexts, etc, so I might be stearing you in the wrong direction here. But what's the ownership of aspx file(s) - ie compare the owners of both aspx files/resources (Security tab, advance, etc).
Edit: I just read the VB.NET doco, and the ReDim was right (changed from VB6), but FileStream.Read is expecting a count. I'd probably change the ReDim anyway, just from a consisency/maintainability point of view, though.
Oh, and I'm assuming that the posted code is a cut-down version, without the error/sanity checking... [A]