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

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.