![Avatar of Tim](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
Tim
asked on
Data leak on AJAX call return data.
I run an intranet site authenticating using Windows Authentication (the users Windows Login accounts).
Anyhow, My program makes AJAX calls to my C# code behind files and I am having issues with the return data being leaked between users when multiple users make a query at the same time, user 1 may get user 2's data and vice versa.
Can anyone tell me where I am going wrong and how I can improve this. Below is what I am using (omitting some table specific javascript code). The code itself works fine outside of this issue.
Thanks
Anyhow, My program makes AJAX calls to my C# code behind files and I am having issues with the return data being leaked between users when multiple users make a query at the same time, user 1 may get user 2's data and vice versa.
Can anyone tell me where I am going wrong and how I can improve this. Below is what I am using (omitting some table specific javascript code). The code itself works fine outside of this issue.
UserLookup(IDList)
{
var strIDs = IDList.split("\n");
var arrayLength = strIDs.length;
var HDCount = 0;
if (strIDs[HDCount] != null && strIDs[HDCount].length >= 7)
{
var HDxmlhttp = new XMLHttpRequest();
HDxmlhttp.onreadystatechange = function ()
{
if (HDxmlhttp.readyState == 4 && HDxmlhttp.status == 200)
{
var inputdata = HDxmlhttp.responseText;
HDCount++;
if (HDCount < arrayLength)
{
HDxmlhttp.open("POST", "userlookup.aspx/Search", true);
HDxmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
HDxmlhttp.send("Method=" + encodeURIComponent("Search") + "&ID=" + encodeURIComponent(strIDs[HDCount]));
}
else
{
}
}
}
HDxmlhttp.open("POST", "userlookup.aspx/Search", true);
HDxmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
HDxmlhttp.send("Method=" + encodeURIComponent("Search") + "&ID=" + encodeURIComponent(strIDs[HDCount]));
}
}
Thanks
![Avatar of Tim](https://cdn.experts-exchange.com/images/experts-exchange/avatar-01-large.gif)
ASKER
Hi gr8gonzo,
My C# code performs its works then sends back the response to the AJAX callback function as an example:
HttpContext.Current.Respon se.Write(" TEST");
HttpContext.Current.Respon se.End();
I don't perform any special checks to know who is sending data, I just receive the call on the C# side, process the data sent and return data to it as per the above code.
What would be the correct way to go about this?
Thanks
My C# code performs its works then sends back the response to the AJAX callback function as an example:
HttpContext.Current.Respon
HttpContext.Current.Respon
I don't perform any special checks to know who is sending data, I just receive the call on the C# side, process the data sent and return data to it as per the above code.
What would be the correct way to go about this?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It sounds like maybe the ASP.NET script is doing some juggling of requests (maybe it has a queue that gets processed and is simply returning the first value it gets from the queue instead of looking for the CORRECT response from the queue).