Links

 

Export to CSV from the ASP.NET using C#

Here is some sample code for outputting some CSV content from the web to a browser, as a downloadable CSV file.
var delimitedOutput = 'test,me,now' Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=thefile.csv"; Response.ContentType = "text/csv"; Response.AddHeader("Pragma", "public"); Response.Write(delimitedOutput); Response.End();
Submit a comment, suggestion, or additional information about this snippet
If you login or register, you'll be able to post a comment or provide feedback about this snippet.
Contact Us | Terms of Use