aspx csv download error

Discussion in 'ASP.NET / ASP.NET Core' started by tomtom, Feb 22, 2010.

  1. Hi,
    Got this code that makes a downloadable csv from the makeTextfromDT function which makes csv from a datatable.
    When run locally it runs fine. I cannot upload it to the 'root' of the website as this is currently live. So I created another folder, uploaded the app and made it an application.
    I then get an error which essentially says I am trying to download the .aspx and this is blocked.
    Any help appreciated
    Thanks
    Tom

    Code:
    Response.ContentType = "text/comma-separated-values"
    Response.AddHeader("Content-Disposition", "attachment; filename=" & sReportName & ".csv")
    EnableViewState = False
    Response.Write(makeTextfromDT(dtResults, False))                 
    
     
  2. Solved

    Hi
    In addition to
    Code:
    Response.Clear()
    I had to:

    Code:
    Response.ClearContent()
    Response.ClearHeaders()
    
    Works now.

    Thanks.
     

Share This Page