How to block and release a Response?

  • Thread starter Thread starter Bruce W.1
  • Start date Start date
B

Bruce W.1

I have a web page (called Page1) with an iFrame and a button on it. The
URL for the iFrame is another page, lets call it Page2. On Page1 I tack
a querystring onto the Page2 URL. The querystring tells Page2 to either
respond immediately or go into a Thread.Sleep state, which blocks the
Response.

I want another Page1 browser window to wake up the other one that's
sleeping. I do this with a querystring to Page2 which tells it to set
an Application["WakeUp"] = "true";

The thread that's sleeping actually loops once per second checking if
Application["WakeUp"] = "true". If false then it sleeps for another
second, and so on. If true then return the Response.

This isn't working the way I intended. The sleep loop seems to take
control until it times out, I check the iterations and terminate it
after 30 seconds. I don't seem to be able to set Application["WakeUp"]
= "true" (with the other browser) while the sleep loop is going. So the
loop never stops until time-out.

Is this making any sense? I know this sort of thing is not normally
done.

How can I put up an application-wide flag that tells all sleeping
responses to wake-up and complete the Response? The Application State
is the only way I can find to share anything between different browser
sessions. Rather than doing a sleep loop I'd much rather have an event
go to all sleeping responses.

Thanks for your help.
 
this approach will never work.

look at it from the browser point of view.

->> request (1) page 2 (sleep)

->> cancel request (1)
->> request (2) page 2 (wakeup)
<-- response request (2)

<-- server thows away request (1) response


also as the browser only supports two active connections to the same server,
its easy to lockup with this design.




-- bruce (sqlwork.com)
 
bruce said:
this approach will never work.

look at it from the browser point of view.

->> request (1) page 2 (sleep)

->> cancel request (1)
->> request (2) page 2 (wakeup)
<-- response request (2)

<-- server thows away request (1) response

also as the browser only supports two active connections to the same server,
its easy to lockup with this design.

-- bruce (sqlwork.com)
=======================================================

Sorry, I should have mentioned, Page1 and Page2 are running off of two
separate DLL's, two projects.
 
Back
Top