I think this is more of a IIS configuration issue rather than an ASP
issue. Anyway, here's the problem:
I have a client that is getting a " HTTP 405 - Resource not allowed" error whenever he calls a (classic) ASP page from a js file using
window.XMLHttpRequest, using POST method. The ASP page is implemented
in VB, code for the asp page is here:
http://www.elsasoft.org/samples/save_description.asp.txt
I figure the
problem is a IIS config issue.
I have asked the client to follow the
steps here but they say it doesn't fix the issue:
http://www.somacon.com/p126.php
any ideas much appreciated!
Here is the client side javascript code that is doing the POST:
function submitEdit(that) {
var hasInnerText = (document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;
that = that.parentNode;
var text = that.childNodes[0].value;
if (xmlHttpReq == null) {
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
} else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
} else {
alert("Cannot send the changes to the server because this browser \r\ndoes not support window.XMLHttpRequest or window.ActiveXObject.");
return;
}
}
xmlHttpReq.open('POST', 'save_description.asp', true);
xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
if (xmlHttpReq.responseText != 'OK') {
// oops, we got an error. show the error in another window.
var w = window.open("", "_blank");
w.document.write(xmlHttpReq.responseText);
}
else
{
that.innerHTML = '<span></span> (<span class="link" onclick="editDesc(this)">edit</span>)'
if (hasInnerText)
that.childNodes[0].innerText = text;
else
that.childNodes[0].textContent = text;
}
}
}
var server = that.server;
var database = that.database;
var propName = (that.propName != null) ? escape(that.propName) : "MS_Description";
var level0type = that.level0type;
var level0name = that.level0name;
var level1type = that.level1type;
var level1name = that.level1name;
var level2type = that.level2type;
var level2name = that.level2name;
var filename = that.filename;
if (that.server == null && !hasInnerText)
{
if (that.attributes["server"] != null) server = that.attributes["server"].textContent;
if (that.attributes["database"] != null) database = that.attributes["database"].textContent;
if (that.attributes["propName"] != null) propName = that.attributes["propName"].textContent;
if (that.attributes["level0type"] != null) level0type = that.attributes["level0type"].textContent;
if (that.attributes["level0name"] != null) level0name = that.attributes["level0name"].textContent;
if (that.attributes["level1type"] != null) level1type = that.attributes["level1type"].textContent;
if (that.attributes["level1name"] != null) level1name = that.attributes["level1name"].textContent;
if (that.attributes["level2type"] != null) level2type = that.attributes["level2type"].textContent;
if (that.attributes["level2name"] != null) level2name = that.attributes["level2name"].textContent;
if (that.attributes["filename"] != null) filename = that.attributes["filename"].textContent;
}
var request = "server=" + escape(server);
request += "&database=" + escape(database)
request += "&text=" + escape(text);
request += "&propName=" + escape(propName);
if (level0type != null) request += "&level0type=" + escape(level0type);
if (level0name != null) request += "&level0name=" + escape(level0name);
if (level1type != null) request += "&level1type=" + escape(level1type);
if (level1name != null) request += "&level1name=" + escape(level1name);
if (level2type != null) request += "&level2type=" + escape(level2type);
if (level2name != null) request += "&level2name=" + escape(level2name);
if (filename != null) request += "&filename=" + escape(filename);
xmlHttpReq.send(request);
}