Henrik Stidsen wrote:
Clint wrote:
>When Button1 is clicked, it submits a GET to the server.
The server doesn't send a response to this get immediatelly, the
server is waiting for some other event to occur (not from the client,
but in it's own surrounding) before it responds.
Now when this is happening, if the user clicks on the 2nd button,
I want to send the text in the text box to the server through a 2nd
GET (served by a different asp page).
>Is such a thing possible at all? If not, any other change
I can make to my design to simulate this?
Depending on what it is you want to do you might get a good result
from using AJAX.
I am already using AJAX - the GETs I was talking about is something
like this
xmlHttp = GetXmlHttpObject(processResponse); // Hook a callback to the
response
xmlHttp.open("GET",url,true);
and then send.
This is the problem I am having.
My browser client does 2 things.
One of the GETs it sends is something for which the server can send a
response immediatelly.
- for eg. if the user clicks on a button "getinfoX" - it calls the server to
getinfoX which the
server returns immediatelly.
- The other GET is used in the following way - send a request to server
"send me a response
when some event happens at the server" i.e. when I send this GET the server
has no response to send immediately - but as and when the event happens,
the server uses this GET to inform the other clients about this. I don't
want to
use polling here & hence I want to send a GET to server which can be left
hanging around in the server to use for this notification.
To achieve this I have 2 frames on my client - one hidden & one regular.
One of them sends the regular GET as a result of user clicking the button
& the other sends the pending GET.
On the server, I have 2 pages, both derived from System.web.ui.Page.
I do the processing on Page_load in both the pages.
In the first one I have
protected void Page_Load() {
// stuff
Response.Write(something)
}
In the 2nd GET aspx - I have to have a loop like this.
protected void Page_Load() {
// stuff
while(true) {
if(HasEventHappened()) {
Response.Write(something);
break;
}
Thread.Sleep(sometime);
}
}
Now, because of this while loop, the server never gets the other GET at
all - i.e.
it seems to be stuck in this while loop & hence is not able to process the
other
GET.
I am total newbie with Web programming - so forgive me if my question is
totally
stupid.
Is my design totally wrong?
Is there a better way to achive what I want - i.e. the ability for a client
to
recieve 2 kinds of responses - one synchronous & the other asynchronous.