Streaming PDF to browser

  • Thread starter Douglas McCormick
  • Start date
D

Douglas McCormick

Hello,

I am looking for the best way to securely stream a PDF to the browser (IE).
The PDF would be inside our firewall, so presumably there would have to be
some sort of middle-tier app inside the firewall that would receive a
request from a browser and then get the PDF and stream it outside the
firewall to the browser.

Does that make sense?

Thanks,
Douglas
 
D

Douglas McCormick

Steve,

Thanks for the reply. However, that sounds like the browser would need
access to the file structure. In my case, the actual PDF is inside the
firewall, so the browser does not have access. I also cannot copy the PDF
outside of the firewall and put on the web server because it is not secure.
Someone could hack the web server and get access to the PDF. It has to be
secure.

Thanks,
Douglas
 
B

bill

They would not need access to the file structure - the file would be
streamed to the browser through the firewall via FTP.

Take a look at the second link that Steve replied - the exact clode that you
need is included there in the "Download" section.
 
S

Steven Cheng[MSFT]

Hi Douglas,

If you do not want to make your ASP.NET application access the actual file
directly, you expose those PDF file stream through an intermediate service.
You this service can access the original raw PDF file or data storage and
pass it to your ASP.NET web application through some distrubute service
communciation( such as webservice, remoting .....).

In your ASP.NET page (or custom http handler), you simply communicate to
the intermediate service to get the binary content of the file stream and
write it out to the response stream. e.g.

============
private void Page_Load(object sender, System.EventArgs e)
{
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "Application/pdf";


byte[] filebytes = //get binary content through
intermediate component/service

Response.BinaryWrite(filebytes);
Response.End();
}

=====================

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 
H

Hans Kesting

Steve,
Thanks for the reply. However, that sounds like the browser would need
access to the file structure. In my case, the actual PDF is inside the
firewall, so the browser does not have access. I also cannot copy the
PDF outside of the firewall and put on the web server because it is
not secure. Someone could hack the web server and get access to the
PDF. It has to be secure.

The browser does not need to access that PDF file directly. Response.WriteFile
retrieves the file server side and send the bytes of that file to the browser.
So it's your webserver that is doing the reading.
Now you still need to figure out how that webserver can get access to
that pdf file :-(.

Hans Kesting
 
S

Steven Cheng[MSFT]

You can also look for some reference and information about programmatically
generate binary output in web page over the internet. If there is anything
else you wonder, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top