How do I - Redirect to Dynamic File Type

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

Have some code that creates a string that contains information in PDF format
so user can print it correctly formatted. How do I send it to the browser
when they have clicked the hyperlink for an ASP page and so their browser is
expecting HTML not a PDF document??
 
-----Original Message-----
Have some code that creates a string that contains
information in PDF format so user can print it correctly
formatted. How do I send it to the browser
when they have clicked the hyperlink for an ASP page and
so their browser is expecting HTML not a PDF document??

Issue the following statements:

Response.Clear
Response.ContentType = "application/pdf"

The first statement erases the existing HTTP headers, and
the second adds a header that tell the browser to expect
data in PDF format. If possible, you should also set
Response.ContentLength to the number of bytes in your PDF
string.

Having done this, use a Response.BinaryWrite to send your
PDF data to the client.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
Back
Top