REAL asynch XmlHttp with IE | | |
I created a page in ASP.Net (with no buffering) that does the following:
Output line #1
FLUSH
{wait 1 second}
Output line #2
{wait 1 second}
Output line #3
FLUSH
......etc
If I browse to the page, you can see that the response comes back as a
STREAM, as it happens. (Note you can only see this the SECOND time the page
is loaded in IE)
When I use XmlHttp in IE, the response only comes back when the WHOLE page
is done. However, in other browsers, it works as expected. The
onreadystatechange raises the event in my JS callback function when the
document is complete, but FireFox raises it for each FLUSH, which is the
effect I need. I would like to know if anyone else can make IE XmlHttp object
do the stream.
Example code: (C#)
private void Page_Load(object sender, System.EventArgs e)
{
Response.ClearContent();
Response.BufferOutput = false;
Response.Write("Output line #1<br/>" + CRLF);
Response.Flush();
System.Threading.Thread.Sleep(1000);
Response.Write("Output line #2<br/>" + CRLF);
Response.Flush();
System.Threading.Thread.Sleep(1000);
//etc..
Techniques I have tried:
1) Asynch Http Module - the module worked, but the client side still did not
2) JavaScript work arounds:
a) Polling
b) Remote Scripting (this works, but must use a GET, and so is not as
secure)
c) Timeouts (too many requests)
3) HTA - also works, but only on IE
Any help would be appreciated! | | | | re: REAL asynch XmlHttp with IE
The problem in IE is that IE is being as strict as XML is. The document is
not well-formed until all opening tags are closed. This is likely to cause
problems with other browsers as well. If not now, perhaps later.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
"Ric" <Ric@discussions.microsoft.com> wrote in message
news:FBD7F855-18A1-41FE-84AD-20E99F699E25@microsoft.com...[color=blue]
>I created a page in ASP.Net (with no buffering) that does the following:
> Output line #1
> FLUSH
> {wait 1 second}
>
> Output line #2
> {wait 1 second}
>
> Output line #3
> FLUSH
> .....etc
>
> If I browse to the page, you can see that the response comes back as a
> STREAM, as it happens. (Note you can only see this the SECOND time the
> page
> is loaded in IE)
>
> When I use XmlHttp in IE, the response only comes back when the WHOLE page
> is done. However, in other browsers, it works as expected. The
> onreadystatechange raises the event in my JS callback function when the
> document is complete, but FireFox raises it for each FLUSH, which is the
> effect I need. I would like to know if anyone else can make IE XmlHttp
> object
> do the stream.
>
> Example code: (C#)
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> Response.ClearContent();
> Response.BufferOutput = false;
>
> Response.Write("Output line #1<br/>" + CRLF);
> Response.Flush();
> System.Threading.Thread.Sleep(1000);
>
> Response.Write("Output line #2<br/>" + CRLF);
> Response.Flush();
> System.Threading.Thread.Sleep(1000);
>
> //etc..
>
>
> Techniques I have tried:
> 1) Asynch Http Module - the module worked, but the client side still did
> not
> 2) JavaScript work arounds:
> a) Polling
> b) Remote Scripting (this works, but must use a GET, and so is not as
> secure)
> c) Timeouts (too many requests)
> 3) HTA - also works, but only on IE
>
> Any help would be appreciated![/color] | | | | re: REAL asynch XmlHttp with IE
while Mozilla/Firefox/safari copied the XMLHTTP object, they coded for use
in the browser (even adding SOAP support), while the microsoft version is
actually part the msxml kit. it doesn't support async (the ServerXmlHTTP
does, but can not be used by the browser).
to do what you want, i'd poll with xmlhttp (no sleep, each one is its own
request) or use the iframe pattern. using document.write and an iframe you
can pass as mush data to the server as you want. the server can flush code
like
Response.Write(string.Format(@"<input type=hidden id=foo" value="{0}">
<script>parent.processData(document.getElementById ('foo').value);</script>",
HttpUtility.HtmlEncode("myvalue"));
Response.Flush();
-- bruce (sqlwork.com)
"Ric" <Ric@discussions.microsoft.com> wrote in message
news:FBD7F855-18A1-41FE-84AD-20E99F699E25@microsoft.com...[color=blue]
>I created a page in ASP.Net (with no buffering) that does the following:
> Output line #1
> FLUSH
> {wait 1 second}
>
> Output line #2
> {wait 1 second}
>
> Output line #3
> FLUSH
> .....etc
>
> If I browse to the page, you can see that the response comes back as a
> STREAM, as it happens. (Note you can only see this the SECOND time the
> page
> is loaded in IE)
>
> When I use XmlHttp in IE, the response only comes back when the WHOLE page
> is done. However, in other browsers, it works as expected. The
> onreadystatechange raises the event in my JS callback function when the
> document is complete, but FireFox raises it for each FLUSH, which is the
> effect I need. I would like to know if anyone else can make IE XmlHttp
> object
> do the stream.
>
> Example code: (C#)
>
> private void Page_Load(object sender, System.EventArgs e)
> {
> Response.ClearContent();
> Response.BufferOutput = false;
>
> Response.Write("Output line #1<br/>" + CRLF);
> Response.Flush();
> System.Threading.Thread.Sleep(1000);
>
> Response.Write("Output line #2<br/>" + CRLF);
> Response.Flush();
> System.Threading.Thread.Sleep(1000);
>
> //etc..
>
>
> Techniques I have tried:
> 1) Asynch Http Module - the module worked, but the client side still did
> not
> 2) JavaScript work arounds:
> a) Polling
> b) Remote Scripting (this works, but must use a GET, and so is not as
> secure)
> c) Timeouts (too many requests)
> 3) HTA - also works, but only on IE
>
> Any help would be appreciated![/color] | | | | re: REAL asynch XmlHttp with IE
Kevin,
I am sorry, but I do not think this has anything to do with well formed Xml.
The data sent back is actually valid XhtML.
Also, I am using the msXmlHttp .ResponseBody property not .Xml
Than you | | | | re: REAL asynch XmlHttp with IE
Bruce,
The msXmlHttp does return for each method: when I set the mthod, .Open the
connection, and receive the data. So it is _kind_of_ ansyncronous in that my
other javaScript events may respond.
I hoping there may be a property that I maight be able to set or maybe use
the .ResponseXml to get the data as it comes out.
I am afraid you may be correct: while I may be able to code around the issue
with timeouts or remote scripting, msXmlHttp object does not give me the
response stream as it is sent - it waits until the whole document is done.
Is is unfortunate that Microsoft inveted this capability, but has not
implemented this obvious use, but Mozilla has. Do you know of any existing
remote scripting that works like the XmlHttp object (not frames!)? | | | | re: REAL asynch XmlHttp with IE
It looks like this problem is with Internet Explorer and not just XmlHttp
object
I put an example up on http://www.ECMASCRIPT.net/
If you click on the link in Firefox you get the document as it streams.
If you click on the link in IE, it waits until the whole document is done
the first time. If you hit refresh on /TimedOutput.aspx you get the same as
firefox.
The button simply uses the Xmlhttp object to request the same page and
display the result as it get it. It works well in fireFox, but not IE
Is this a header problem? Or did I set up IIS wrong? Can I write my Asp.Net
Page any way to fix this?
Any help would be appreciated! |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,467 network members.
|