C
Chris
Hi,
how can I send information that is in the Response.OutputStream to the
client but continue server processing without having to close the page , or
without having to Reponse.End() the application ?
I tried Response.OutputStream.Flush(); but it doesn't seem to work, only
when I follow it with a Reponse.End() , but that's then gonna stop the
server processing what is what I don't want.
Here's my problem : in a button-event handler
void btnSubmitSendback_Click(object sender, System.EventArgs e)
{
byte[] sendData = Encoding.ASCII.GetBytes(strXmlContent);
// strXmlContent contains some info I want the client to save
// Popup a dialog-box at the client
Response.AddHeader("content-disposition","attachment;");
Response.OutputStream.Write(sendData, 0, sendData.Length);
lblStatus.Text = "OK";
}
The result is that the client gets a "File Save as..." dlgBox allowing him
to save the contents. OK.
Problem is that not only 'strXmlContent' was saved but the contents of the
HTML-page as well !!
Now, I try to separate the two by :
// first sending the content then clearing the header
Response.AddHeader("content-disposition","attachment;");
Response.OutputStream.Write(sendData, 0, sendData.Length);
Response.OutputStream.Flush();
Response.ClearHeaders();
lblStatus.Text = "OK";
but it doesn't work. I tried lots of other things, as well using
Response.ClearContent() but nothing works.
Using Response.End() after the Response.OutputStream.Write(...) will show
the popup but will not return my new page. (so the client doesn't see "OK")
Anyway, either the new page is shown to the client but then no popup
appears, or the client gets a popup but the info saved contains the
html-code of the page as well.
So, actually do I want to send some info to the client enabling him to save
the
info (and nothing else) via a popup, and as well do I want to show the
client the
refreshed page.
Any help GREATLY appreciated
Chris
how can I send information that is in the Response.OutputStream to the
client but continue server processing without having to close the page , or
without having to Reponse.End() the application ?
I tried Response.OutputStream.Flush(); but it doesn't seem to work, only
when I follow it with a Reponse.End() , but that's then gonna stop the
server processing what is what I don't want.
Here's my problem : in a button-event handler
void btnSubmitSendback_Click(object sender, System.EventArgs e)
{
byte[] sendData = Encoding.ASCII.GetBytes(strXmlContent);
// strXmlContent contains some info I want the client to save
// Popup a dialog-box at the client
Response.AddHeader("content-disposition","attachment;");
Response.OutputStream.Write(sendData, 0, sendData.Length);
lblStatus.Text = "OK";
}
The result is that the client gets a "File Save as..." dlgBox allowing him
to save the contents. OK.
Problem is that not only 'strXmlContent' was saved but the contents of the
HTML-page as well !!
Now, I try to separate the two by :
// first sending the content then clearing the header
Response.AddHeader("content-disposition","attachment;");
Response.OutputStream.Write(sendData, 0, sendData.Length);
Response.OutputStream.Flush();
Response.ClearHeaders();
lblStatus.Text = "OK";
but it doesn't work. I tried lots of other things, as well using
Response.ClearContent() but nothing works.
Using Response.End() after the Response.OutputStream.Write(...) will show
the popup but will not return my new page. (so the client doesn't see "OK")
Anyway, either the new page is shown to the client but then no popup
appears, or the client gets a popup but the info saved contains the
html-code of the page as well.
So, actually do I want to send some info to the client enabling him to save
the
info (and nothing else) via a popup, and as well do I want to show the
client the
refreshed page.
Any help GREATLY appreciated
Chris