Asp.net multipart output-flush

Source: Internet
Author: User

Saw bearrui (AK-47) brothers of High Performance Web Development (11)-flush let the page block, gradually present, found that is an example of using JSP. I didn't understand how to do this in Asp.net. I checked it from msdn and found this thing response. Flush ().

The sameCodePost it

 

  <  Div  ID  = "Head"  Style  = "Border: 1px solid # CCC ;"  >  
Cnblogs logo < IMG SRC = "Http://home.cnblogs.com/images/logo_cnblogs_sns.gif" />
</ Div >
< BR />

< Div ID = "Content" Style = "Border: 1px solid blue ;" >
<%
// Sleep for 3 seconds
Thread. Sleep ( 3000 );
%>
Csdn logo < BR />
< IMG SRC = "Http://csdnimg.cn/www/images/csdnindex_piclogo.gif" />
</ Div >

In this case, the page is blank after 3 seconds.

 

Then add response. Flush ()

 

  <  Div  ID  = "Head"  Style  = "Border: 1px solid # CCC ;"  >  
Cnblogs logo < IMG SRC = "Http://home.cnblogs.com/images/logo_cnblogs_sns.gif" />
</ Div >
<%
Response. Flush (); // Flush response, multipart output
%>
< BR />

< Div ID = "Content" Style = "Border: 1px solid blue ;" >
<%
// Sleep for 3 seconds
Thread. Sleep ( 3000 );
%>
Csdn logo < BR />
< IMG SRC = "Http://csdnimg.cn/www/images/csdnindex_piclogo.gif" />
</ Div >

In this way, the above logo is displayed first and then sleep appears for 3 seconds. Haha, I learned how to output it in blocks, which is quite simple.

 

I'm stupid! I found out that some of my blog's comments mentioned that response. Flush () can be used. I have to work hard to check the comments for a long time without using msdn.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.