Excel export goes to .aspx file extension in Chrome and Edge

Posted by: robertwilliams673 on 11 January 2022, 3:27 am EST

  • Posted 11 January 2022, 3:27 am EST

    I have a page that uses a gridview in an .aspx web page with a linkbutton to export to Excel. It works fine in Internet Explorer, but in Edge and Chrome, it opens up as a Save with a .aspx extension. I created a simple test page to try to solve this issue. It is attached. My google searches have found a couple of items of tinkering with the response, but the solutions have not worked for me.

    I have another page in the same application that works fine in Chrome. I haven't found the difference, yet.

    Support was unable to duplicate the issue.

    Has anyone else had this issue?Example.zip
  • Replied 11 January 2022, 8:19 pm EST

    Hello ,

    such issues are not related to ActiveReports directly. any excel file that you would send to the client with that code shows the same behavior.

    please try this code:
    Response.AddHeader("content-disposition", "inline; filename=BBP_Exposure_List.xlsx")
    Response.ContentType = "application/excel"

    Sergey Romanov.
  • Replied 12 January 2022, 3:36 am EST

    Thanks, but no that did not fix this issue. There must be something different about this page, but I haven't found it. I created the test page from scratch.
  • Replied 17 January 2022, 10:14 pm EST

    Hi Robert,

    We have answered your issue on your support case already. We were unable to replicate your issue after testing with Internet Explorer, Google Chrome, Microsoft Edge and Firefox and the application is downloading .xlsx excel file.
    As this issue is unrelated to ActiveReports you may refer to the following page on the Microsoft Forum:
  • Replied 18 January 2022, 8:13 am EST

    I'm sorry I stepped on your toes. I just thought maybe someone else had found a solution to this issue. The response code in the Microsoft Forum link did not solve the issue.
  • Marked as Answer

    Replied 18 January 2022, 10:45 pm EST

    Hello ,

    i have re-used your code from the first post in the attached sample to reproduce the issue.
    and the issue disappeared after these changes:
    Response.AddHeader("content-disposition", "inline; filename=BBP_Exposure_List.xlsx")
    Response.ContentType = "application/excel"

    the sample is attached.

    Sergey Romanov.
  • Replied 19 January 2022, 12:41 am EST

    Thanks Sergey! I was missing the filename= in the content-dispostion header. I just couldn't see that issue as I viewed the code. Thanks for the help!
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels