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

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
 
B

bruce barker

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)
 
A

al

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
 
A

al

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top