I need to send a CSV file in HTTP response. How can I set the output response as CSV format?
This is not working:
Response.ContentType = 'application/CSV';
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using
text/csvis the most appropriate type.You should also consider adding a
Content-Dispositionheader to the response. Often a text/csv will be loaded by a Internet Explorer directly into a hosted instance of Excel. This may or may not be a desirable result.The above will cause a file ‘Save as’ dialog to appear which may be what you intend.