Remove Response.End() and let the response end naturally within the ASP.NET ecosystem.
If that does not work, I would recommend putting the button in a separate and post the required data to a separate HTTP handler. Setup the HTTP handler to export the XML instead of a web page.