ASP.net attachment then refresh page
Posted
by Russell
on Stack Overflow
See other posts from Stack Overflow
or by Russell
Published on 2009-11-11T04:01:47Z
Indexed on
2010/05/09
5:38 UTC
Read the original article
Hit count: 208
I am working on a c# project using ASP .net.
I have a list of reports with a hyperlink for each, which calls the web server, retrieves a PDF and then returns the PDF for the user to save or open:
ASPX page:
<table>
<tr>
<td>
<a href="#" onclick="SubmitFormToOpenReport();">Open Report 1</a>
<td>
</tr>
...
</table>
ASP.Net:
context.Response.Clear();
context.Response.AddHeader("content-disposition", "attachment;filename=report.pdf");
context.Response.Charset = "";
context.Response.ContentType = "application/pdf";
context.Response.BinaryWrite(myReport);
context.Response.Flush();
This works as expected, however I would like it to also refresh the page with an updated list.
I am having trouble as the single request/response is returning the report.
Is there a way to refresh the page as well?
While there is a correct response, feel free to include answers which details alternative solutions/ideas for doing this.
© Stack Overflow or respective owner