Response.Flush problem

Discussion in 'ASP .Net' started by Mantas Miliukas, Mar 14, 2005.

  1. Hi,

    I have problem when flushing the generated HTML code to the client.
    It seems that "Page.Response.Flush()" method doesn't work at all.
    See my code below:

    protected override void Render(HtmlTextWriter writer)
    {
    for (int i = 0; i < 100; i ++)
    {
    writer.Write("...");
    writer.Flush();

    Page.Response.Flush();
    System.Threading.Thread.Sleep(1000);
    }
    }

    The "..." are not sent to the client until the whole asp.net page is
    generated.
    Have any clues, ideas?

    Thanks for your help.

    ---
    m2
     
    Mantas Miliukas, Mar 14, 2005
    #1
    1. Advertising

  2. Mantas Miliukas

    Patrice Guest

    1) Not buffered ?
    2) Try to enclose this in a tag. Don't remember this exact point but AFAIK
    most browsers render up to the last closing tag...

    Patrice
    --

    "Mantas Miliukas" <> a écrit dans le message de
    news:...
    > Hi,
    >
    > I have problem when flushing the generated HTML code to the client.
    > It seems that "Page.Response.Flush()" method doesn't work at all.
    > See my code below:
    >
    > protected override void Render(HtmlTextWriter writer)
    > {
    > for (int i = 0; i < 100; i ++)
    > {
    > writer.Write("...");
    > writer.Flush();
    >
    > Page.Response.Flush();
    > System.Threading.Thread.Sleep(1000);
    > }
    > }
    >
    > The "..." are not sent to the client until the whole asp.net page is
    > generated.
    > Have any clues, ideas?
    >
    > Thanks for your help.
    >
    > ---
    > m2
    >
    >
     
    Patrice, Mar 14, 2005
    #2
    1. Advertising

  3. Hi,

    Thanks for your ideas!

    1) I have disabled buffer in aspx page explicitly by
    adding "Buffer" property set to "False". I also removed buffering using IIS
    management concole.

    2) I have tryied this one too, however without a success.

    PS. Must note that everything works fine, when the control is moved outside
    the HTML body.
    See the example below:

    <my:LongLastingRendering Runat="Server" .../>
    <html>
    ...[Other html code]
    </html>

    However the Response.Flush doesn't work when i change the code above into:

    <html>
    ....
    <body>
    <my:LongLastingRendering Runat="Server" .../>
    </body>
    </html>

    --
    m2

    "Patrice" <> wrote in message
    news:%...
    > 1) Not buffered ?
    > 2) Try to enclose this in a tag. Don't remember this exact point but AFAIK
    > most browsers render up to the last closing tag...
    >
    > Patrice
    > --
    >
    > "Mantas Miliukas" <> a écrit dans le message de
    > news:...
    >> Hi,
    >>
    >> I have problem when flushing the generated HTML code to the client.
    >> It seems that "Page.Response.Flush()" method doesn't work at all.
    >> See my code below:
    >>
    >> protected override void Render(HtmlTextWriter writer)
    >> {
    >> for (int i = 0; i < 100; i ++)
    >> {
    >> writer.Write("...");
    >> writer.Flush();
    >>
    >> Page.Response.Flush();
    >> System.Threading.Thread.Sleep(1000);
    >> }
    >> }
    >>
    >> The "..." are not sent to the client until the whole asp.net page is
    >> generated.
    >> Have any clues, ideas?
    >>
    >> Thanks for your help.
    >>
    >> ---
    >> m2
    >>
    >>

    >
    >
     
    Mantas Miliukas, Mar 14, 2005
    #3
  4. Mantas Miliukas

    Jeff @ Dart Guest

    Try Page.Response.Write instead of Writer.Write? I'm guessing the
    HtmlTextWriter doesn't write directly to the response stream, but
    buffers internally and writes all the page data at once?
     
    Jeff @ Dart, Mar 14, 2005
    #4
  5. Ok, I will try, thanks for Your suggestions.

    "Jeff @ Dart" <> wrote in message
    news:...
    > Try Page.Response.Write instead of Writer.Write? I'm guessing the
    > HtmlTextWriter doesn't write directly to the response stream, but
    > buffers internally and writes all the page data at once?
    >
     
    Mantas Miliukas, Mar 15, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Glen Wilkin via DotNetMonster.com

    Response.Redirect after Response.Flush

    Glen Wilkin via DotNetMonster.com, Apr 15, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    6,956
  2. carlisle411
    Replies:
    4
    Views:
    12,317
    John C. Bollinger
    Feb 28, 2005
  3. Replies:
    5
    Views:
    570
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Jun 12, 2007
  4. Replies:
    3
    Views:
    707
    Andrew Morton
    Jul 31, 2007
  5. Richard N.

    Response.Flush / Response.Redirect

    Richard N., Oct 18, 2003, in forum: ASP General
    Replies:
    1
    Views:
    200
    Tom B
    Oct 19, 2003
Loading...

Share This Page