How to return two results with one postback

Joined
Mar 11, 2009
Messages
1
Reaction score
0
Hi,

Does anyone know if it is possible (and it it is, how) to return multiple download responses for one postback request in ASP.NET.

The scenario is the following:
The user pushes an Export button, after which, in the event handler function of the button an SqlDataReader fills up a TextWriter which overwrites the content of the page's HttpResult.
Ex:
Response.ContentType = "application/text";
Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=\"" + fileName + "\"");
Response.Write(textWriter.ToString());
Response.Flush();
Response.Close();

It works fine till this point.
Now it is required to return two versions of this result with the same button click (only 1-2 extra lines and the filename would be different between the two responses).

I was wondering if it is possible to achieve this using a single postback, because the running time of the SqlDataReader is pretty long (up to 30 sec), and I would like to avoid running it twice if it is possible.
Also the size of the returned recordset can grow up, so i don't want to store it in a session variable.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top