c# - CSV file is not downloading in asp.net because Respose.Write isn't working -
i'm creating csv file stringbuilder
and i'm trying download file following code:
response.clear(); response.buffer = true; response.addheader("content-disposition", "attachment;filename=report.csv"); response.charset = "utf-8"; response.contenttype = "text/csv"; response.output.write(sb.tostring()); response.flush(); response.end();
i'been using same code in other projects no problem, in 1 when click export button
code executed nothing happens, no exception, no error, nothing.
also try following: response.write(sb.tostring());
, "application/text"
or application/csv
anyone can point me in right direction make work?
update
for reason don't understand yet, response.output.write
or response.write
not working because can't anything, not single string or javascript alert.
any idea?
remove line
response.flush();
because response.buffer = true
.
and use
response.write(sb.tostring()); response.end();
Comments
Post a Comment