Render webpage with attachment

  • Thread starter William F. Robertson, Jr.
  • Start date
W

William F. Robertson, Jr.

I am trying to render out a full webpage, but have an attachment with the
page that will open.

Here is the code I am using the send the file.
Response.ClearHeaders();
Response.AddHeader( "Content-Disposition", "attachment;
filename=apdetails.csv" );
Response.ContentType = "text/csv";
Response.BinaryWrite( bytes );

Is there anything I can add to the headers that will stop this attachment so
I can continue sending the regular webpage?

I tried setting the content type back to text/html, but that did nothing
except append the html to the end of my csv file.

TIA,
bill
 
J

John Timney \(Microsoft MVP\)

Your reply cant be two things- it can either be a reponse made up of
html/text or a binary stream which is a file type. Browsers dont understand
mulit-part mixed types

If you need to send two types, send the text with javascript to open a
window with your file, or have it as an iframe in your text response

--
Regards

John Timney
Microsoft Regional Director
Microsoft MVP
 

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,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top