Below is all the code you'll need to duplicate the problem.
DEFAULT.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" language="javascript"
src="javascript/Ajax.js"></script>
<script type="text/javascript" language="javascript">
setTimeout("blah();", 1000);
function clicky() {
blah();
}
function clicky2() {
var a = new Ajax('default.aspx?blah2=a', '', null);
a.returnType = 'JSON';
a.send();
}
function blah() {
var a = new Ajax('default2.aspx?blah=a', '', null);
a.returnType = 'JSON';
a.send();
setTimeout("blah();", 1000);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="updater">
</div>
<div id="updater2">
</div>
<!--<input type="button" onclick="clicky();" value="Start One Second
Timer" />-->
<asp:Button id="blahbutton" runat="server" OnClick="blah_click" Text="Do
One-Time 3 Second Call" />
<!--<input type="button" onclick="clicky2();" value="Do One-Time 3
Second Call" />-->
</form>
</body>
</html>
DEFAULT.ASPX.CS
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
Response.Write("POSTED!<br>");
//Session["hi"] = "hi"; <--- UNCOMMENT TO DUPLICATE PROBLEM
}
protected void blah_click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(10000);
}
}
DEFAULT2.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"
Inherits="Default2" %>
DEFAULT2.ASPX.CS
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["blah"] != null)
{
Response.Write("var a =
document.getElementById('updater');while(a.childNodes.length >
0){a.removeChild(a.childNodes[0]);}a.appendChild(document.createTextNode('");
if (Application["a"] == null)
Response.Write(DateTime.Now.ToString());
else
Response.Write(Application["a"].ToString());
Response.Write("'));");
Response.End();
}
}
}
AJAX.JS
function Ajax(url, requestXml, callback, sendNow) {
this.url = url;
this.requestMethod = "POST";
this.requestXml = requestXml;
this.callback = callback;
this.async = true;
this.returnType = null;
this.setReturnType = __Ajax_SetReturnType;
this.errorCallback = null;
this.timeoutCallback = null;
this.request = null;
this.send = __Ajax_Send;
if(this.url && this.requestXml && this.callback && sendNow != undefined &&
sendNow)
this.send();
}
Ajax.CreateRequest = __Ajax_CreateRequest;
function __Ajax_CallbackIntercept(instance) {
if(instance.request.readyState == 4) {
if(instance.request.status && instance.request.status == 408 &&
instance.timeoutCallback)
instance.timeoutCallback(instance);
else if(instance.request.status && instance.request.status == 200) {
if(instance.returnType == null && instance.callback)
instance.callback(instance);
else if(typeof(instance.returnType) == "string")
if(instance.returnType == "JSON") {
var json = eval(instance.request.responseText);
if(instance.callback)
instance.callback(json, instance);
} else if(instance.returnType == "TEXT") {
instance.callback(instance.request.responseText, instance);
} else if(instance.callback)
instance.callback(instance.request.responseXML, instance);
else {
if(instance.replaceContents) {
while(instance.idOrDomObjectToInsertInto.childNodes.length > 0)
instance.idOrDomObjectToInsertInto.removeChild(instance.idOrDomObjectToInsertInto.childNodes[0]);
}
instance.idOrDomObjectToInsertInto.appendChild(document.createTextNode(instance.request.responseText));
if(instance.callback)
instance.callback(instance.request.responseText);
}
} else {
if(instance.errorCallback)
instance.errorCallback(instance);
}
}
}
function __Ajax_Send() {
var instance = this;
// alert('hey');
//alert(this.request);
this.request = __Ajax_CreateRequest();
if(this.request.overrideMimeType)
this.request.overrideMimeType("text/xml");
this.request.onreadystatechange = function() {
__Ajax_CallbackIntercept(instance);
}
this.request.open(this.requestMethod, this.url, this.async);
this.request.send(this.requestXml);
}
//returnType values = "JSON", "XML", "TEXT", "HTML", "XHTML"
function __Ajax_SetReturnType(returnType, idOrDomObjectToInsertInto,
replaceContents) {
this.returnType = returnType;
this.idOrDomObjectToInsertInto = idOrDomObjectToInsertInto;
this.replaceContents = replaceContents;
if(typeof(this.idOrDomObjectToInsertInto) == "string")
this.idOrDomObjectToInsertInto =
document.getElementById(idOrDomObjectToInsertInto);
}
function __Ajax_CreateRequest() {
var request = null;
try {
request = new XMLHttpRequest();
} catch(e) {}
if(!request && window.ActiveXObject)
return new ActiveXObject("Microsoft.XMLHTTP");
return request;
}