dashrendaer
05-26-2010, 08:01 PM
We are running windows iis and use it's native ability to protect files as our login method.
It works fine, except that when I try to post an post method XMLHttpRequest from IE i get the login dialog again, which causes the request to fail.
The weird thing is that Mozilla works fine.
Is there something I can do with the headers or something to make IIS recognize it as the same session, and not promt a re-login?
function ajaxQuery(method,url,params,asynchronous,readyFunction,is_done){
if(asynchronous == null){
asynchronous = true;
}
//alert("URL: "+url);
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
readyFunction(xmlhttp.responseText);
if(is_done){
is_done("ok");
}
}
}
if(method.toLowerCase() == "get"){
url += "?"+params;
params = null;
}
debug = url;
xmlhttp.open(method,url,asynchronous);
if(method.toLowerCase() == "post"){
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
debug = params.length;
}
xmlhttp.send(params);
}
It works fine, except that when I try to post an post method XMLHttpRequest from IE i get the login dialog again, which causes the request to fail.
The weird thing is that Mozilla works fine.
Is there something I can do with the headers or something to make IIS recognize it as the same session, and not promt a re-login?
function ajaxQuery(method,url,params,asynchronous,readyFunction,is_done){
if(asynchronous == null){
asynchronous = true;
}
//alert("URL: "+url);
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
readyFunction(xmlhttp.responseText);
if(is_done){
is_done("ok");
}
}
}
if(method.toLowerCase() == "get"){
url += "?"+params;
params = null;
}
debug = url;
xmlhttp.open(method,url,asynchronous);
if(method.toLowerCase() == "post"){
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
debug = params.length;
}
xmlhttp.send(params);
}