Msxml2.XMLHTTP object's send method throwing HTTP /1.1 405 - Method not allowed error.

R

RK

I am getting the "HTTP /1.1 405 - method not allowed" error when I am
sending XML string over Msxml2.XMLHTTP object. I am sending data in
POST, also passing querystring variable and here is the code. Also
error comes only sometimes.

var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.Open("POST", "test.aspx?qsVar="+qsVar, false);
xmlhttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
xmlhttp.Send(xmldoc);


any help will be appreciated.

RK
 
M

Martin Honnen

RK said:
I am getting the "HTTP /1.1 405 - method not allowed" error when I am
sending XML string over Msxml2.XMLHTTP object. I am sending data in
POST, also passing querystring variable and here is the code. Also
error comes only sometimes.

var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.Open("POST", "test.aspx?qsVar="+qsVar, false);
xmlhttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
xmlhttp.Send(xmldoc);

Check your web server configuration for that test.aspx, it will probably
not allow POST requests thus you get the HTTP status error code/message
for that case.
 
G

Grant Wagner

RK said:
I am getting the "HTTP /1.1 405 - method not allowed" error when I am
sending XML string over Msxml2.XMLHTTP object. I am sending data in
POST, also passing querystring variable and here is the code. Also
error comes only sometimes.

var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.Open("POST", "test.aspx?qsVar="+qsVar, false);
xmlhttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
xmlhttp.Send(xmldoc);

any help will be appreciated.

RK

What do the server logs say when you get the 405 error?

I'm guessing that xmldoc probably has some invalid content in it.
Obviously the first step in solving this is to try and create a reliably
reproducible test case. Once you can reliably reproduce the problem, you
can examine the content of qsVar and xmldoc to ensure they contain valid
values and check the server logs to determine what exactly is going
wrong.
 
J

Jim Ley

I am getting the "HTTP /1.1 405 - method not allowed" error when I am
sending XML string over Msxml2.XMLHTTP object. I am sending data in
POST, also passing querystring variable and here is the code. Also
error comes only sometimes.

var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
xmlhttp.Open("POST", "test.aspx?qsVar="+qsVar, false);
xmlhttp.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
xmlhttp.Send(xmldoc);

This sounds like your server is rejecting it, and not realted to the
XMLHTTP object at all.

Jim.
 
R

RK

first of all thanks for the responses,

I checked up the following things..

1) Default website on the webserver, .aspx is mapped to
aspnet_isapi.dll with GET, HEAD, POST, DEBUG verbs. I assume the same
is propagated to virtual directories under default web site.

2) I checked xmldoc in xmlhttp.send(xmldoc) method in debug mode, the
xml string is fine.

3) when it prompts "do u wish to debug the javascript error", and when
I select yes, and see the values in debug window, then stop the
debugger, and select no on the javascript error prompt, that lets this
method to go without error.
 
J

Jim Ley

1) Default website on the webserver, .aspx is mapped to
aspnet_isapi.dll with GET, HEAD, POST, DEBUG verbs. I assume the same
is propagated to virtual directories under default web site.

sounds fine.
3) when it prompts "do u wish to debug the javascript error",

but it shouldn't do this if it's a METHOD NOT ALLOWED error, that's
not a javascript one.

Could you maybe put the page online so we could have a look?

Jim.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top