Thread.sleep dose not work from the first time????

  • Thread starter Thread starter al
  • Start date Start date
A

al

Greetings,

I have a simple page with this code in Page_Load event(vb.net):


Response.Buffer=True

Response.write("begin test")

Response.Flush()

system.threading.thread.sleep(5000)

Respoonse.write("end test")



The browser just shows BOTH messages in the first time the page runes,
NO 5 seconds wait. However,when I refresh the page, the code runs
fine, first message for 5 seconds then the second.

MHIA,
Grawsha
 
as you turned buffering on, nothing is sent to the browser until all page
processing is done. the sleep just makes the request take longer.

-- bruce (sqlwork.com)
 
bruce barker said:
as you turned buffering on, nothing is sent to the browser until all page
processing is done. the sleep just makes the request take longer.

-- bruce (sqlwork.com)

Bruce,

I did turn the buffer off but with no change. Brower still does not wait
for 5 seconds in the first time it loads the page. it does so when I refresh.

Grawsha
 
Bruce,

I did turn the buffer off but with no change. Brower still does not wait
for 5 seconds in the first time it loads the page. it does so when I refresh.

Grawsha

Solved!

All what i had to do is add longer string (>200 char)to enable buffer
to send its cont. to browser.
 

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

Back
Top