469,362 Members | 2,441 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

STUMPED: IFRAME link won't load until XMLHTTP finishes!?

You have an active XMLHTTP request on the main page
(localhost/App1/index.aspx) The XMLHTTP request takes about 60 seconds
to receive a response back from localhost/App1/getxml.aspx.

You have an IFRAME on this main page.

When you set the iframe's src to google.com, it works fine.
When you set the iframe's src to localhost/App1/test.htm, it works
fine.
When you set the iframe's src to
localhost/DifferentApplication/index.aspx, it works fine.

When you set the iframe's src to localhost/App1/foo.aspx, IT WONT
LOAD...until the XMLHTTP request has finished.

I'm completely at loss here. fyi: foo.aspx.cs --> Response.Write("hi");

It's like IIS is queuing the requests. BUT, I can make concurrent
XMLHTTP requests and they work fine.

Any experts out there know what's happening?

Aug 16 '05 #1
5 2501
Are you using async XMLHTTP ? The following test.aspx page retrieves rss
feed from MSDN with a 2 second delay to simulate the slow XMLHTTP request:

<%@LANGUAGE=C#%>
<%@Import Namespace="System.Xml"%>
<%@Import Namespace="System.IO"%>
<%@Import Namespace="System.Net"%>
<%
Response.Clear();
Response.ContentType = "text/xml";

System.Threading.Thread.Sleep(2000);
WebRequest req = WebRequest.Create("http://msdn.microsoft.com/rss.xml");
Stream stm = req.GetResponse().GetResponseStream();
int max = 64000;
byte[] buffer = new byte[max];
int len = 0;
while ((len = stm.Read(buffer, 0, max)) > 0) {
Response.OutputStream.Write(buffer, 0, len);
}
Response.End();
%>
Then the following page loads an IFrame then later displays the result of
the XMLHTTP request once the readyState goes to 4 = "complete":

<%@LANGUAGE=C#%><%
Response.ContentType="text/html";
%>
<html>
<script language=jscript>
var http;
function LoadRss() {
http = new ActiveXObject("MSXML2.XMLHTTP");
http.open("GET", "rss.aspx", true);
http.onreadystatechange = Complete;
http.send("");
}
function Complete() {
window.status = "readyState=" + http.readyState;
if (http.readyState == 4) {
var doc = http.responseXML;
RSS.innerText = doc.xml;
}
}
</script>
<body onload="LoadRss()">
<iframe src="frame.htm">
</iframe>
<xmp id=RSS></xmp>
</body>
</html>

This shows that the IFrame loads fine before the XMLHTTP request is
finished.
<ji**********@gmail.com> wrote in message
news:11********************@z14g2000cwz.googlegrou ps.com...
You have an active XMLHTTP request on the main page
(localhost/App1/index.aspx) The XMLHTTP request takes about 60 seconds
to receive a response back from localhost/App1/getxml.aspx.

You have an IFRAME on this main page.

When you set the iframe's src to google.com, it works fine.
When you set the iframe's src to localhost/App1/test.htm, it works
fine.
When you set the iframe's src to
localhost/DifferentApplication/index.aspx, it works fine.

When you set the iframe's src to localhost/App1/foo.aspx, IT WONT
LOAD...until the XMLHTTP request has finished.

I'm completely at loss here. fyi: foo.aspx.cs --> Response.Write("hi");

It's like IIS is queuing the requests. BUT, I can make concurrent
XMLHTTP requests and they work fine.

Any experts out there know what's happening?

Aug 16 '05 #2
The problem I'm having is when both the URL of the XMLHTTP request and
the IFRAME point to pages in the same ASP.NET application.

So to make your code fit this problem, change the Thread.Sleep to
something like 20 seconds. And also change the source of the iframe to
test.aspx.
Then lastly, have a link in the body of your main page that fires
LoadRSS(), then click a link in the Iframe's test.aspx and you'll see
what I'm talking about. The Iframe's won't load until the RSS feed
completes.

Aug 16 '05 #3
Apparently: "XMLHTTP uses WinInet which supports two concurrent HTTP
connections to a given remote server... "

Which does explain some things. However when only one XMLHTTP is
active, I'm strying trying to figure out why an href doesn't respond
until that active xml request terminates.

humm.

Aug 19 '05 #4
ji**********@gmail.com wrote:
Apparently: "XMLHTTP uses WinInet which supports two concurrent HTTP
connections to a given remote server... "

Which does explain some things. However when only one XMLHTTP is
active, I'm strying trying to figure out why an href doesn't respond
until that active xml request terminates.


That might be the async parameter in the open method.

--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML/CSS,Javascript,TCP ...
--`
Aug 23 '05 #5
DrGUI at has a response for this problem here:
http://msdn.microsoft.com/library/de...ui10012002.asp

He recommends using the ServerXMLHTTP object for more scalable
applications.
http://support.microsoft.com/default.aspx?scid=kb;[LN];Q290761

Aug 29 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Vincent van Beveren | last post: by
5 posts views Thread by Jim Marquardson | last post: by
reply views Thread by Aaron Guo | last post: by
3 posts views Thread by PCgeek | last post: by
4 posts views Thread by eyalrab | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.