By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,855 Members | 1,988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,855 IT Pros & Developers. It's quick & easy.

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

P: n/a
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?

Nov 22 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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?

Nov 22 '05 #2

P: n/a
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.

Nov 22 '05 #3

P: n/a
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.

Nov 22 '05 #4

P: n/a
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 ...
--`
Nov 22 '05 #5

P: n/a
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

Nov 22 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.