473,378 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

REAL asynch XmlHttp with IE

Ric
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!
Nov 19 '05 #1
5 1815
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" <Ri*@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
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!

Nov 19 '05 #2
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" <Ri*@discussions.microsoft.com> wrote in message
news:FB**********************************@microsof t.com...
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!

Nov 19 '05 #3
Ric
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
Nov 19 '05 #4
Ric
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!)?

Nov 19 '05 #5
Ric
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!
Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: MasterBlaster | last post by:
We are in the initial stages of design analysis and I'm trying to come up with some ideas on how to handle the feature our users are requiring from the new application. We are using VB.NET/window...
9
by: fochie | last post by:
Greetings, I'm having a problem when I try to GET a file from my server via xmlhttp when using Mozilla. With IE I can get any type of file fine, get/display headers fine, etc. With Mozilla,...
11
by: Glen Wolinsky | last post by:
This is my first attempt as asynchronous processing. I have created a small test app as proof of concept, but I am having one proglem. In the example (code listed below), my callback routine has...
2
by: ghost | last post by:
As the Subject indicates I have written a web page that makes use of several web service calls. Some of the web service calls are very fast so they called synchronously. Some web service calls...
9
by: balakrishnan.dinesh | last post by:
hi friends, Exactly what i want to know is, In my product we are using xmlhttp request to retrive some data from the server, And Im using IE browser, its working fine in IE. Now i want to work...
2
by: Techno_Dex | last post by:
What is the correct way to debug a WS which makes it's call Asynch?
4
by: EM_J | last post by:
I am implementing this interface in one of my pages. The RaiseCallbackEvent method runs a task for about 3 seconds. I've noticed when I am on that page and click a tab to navigate to another...
13
by: yawnmoth | last post by:
<http://www.quirksmode.org/book/printable/xmlhttp.txtshows two alternatives to Microsoft.XMLHTTP - Msxml2.XMLHTTP and Msxml3.XMLHTTP. If my understanding is correct, the different numbers refer to...
0
by: Patino | last post by:
I have a particular WS consumer application (Windows app) that was not able to read an error from the WS app because it was calling a method asynch. The client app just hangs there. But once I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.