I want to sent a text-file to the client in response of clicking a toolbarbutton.
The code to send the file:
Response.ContentType = "text/txt";
Response.AppendHeader("Content-Disposition", "attachment; filename=project_input_export.txt");Response.TransmitFile(Server.MapPath("~/Export/project_input_export.txt"));
When I click on the the toolbarbutton I get the following error:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '##EXPORT##: 13-mrt-1'.
When I call the same code from a RadButton the file is transmitted correctly.
Why can't I get the file from a toolbarbutton?