IIS: 405 (method not allowed) when sent to the default page

I want to POSTgenerate data on the default web server page, for example:

POST http://errorreporting.example.com/ HTTP/1.1

I want the server to be responsible for 302redirecting the client to where it should go POST. A file default.aspon the server performs this task ( which is the technique recommended by Microsoft ) by doing Redirect:

default.asp:

<%
   Response.Redirect "SubmitError.ashx"
%>

When I just browse the server:

GET http://errorreporting.example.com/ HTTP/1.1

I get the expected response from the server:

HTTP/1.1 302 Object moved
Server: Microsoft-IIS/5.0
Location: SubmitError.ashx
...

But when I'm POSTon the server:

POST http://errorreporting.example.com/ HTTP/1.1

The server is getting very angry with me:

HTTP/1.1 405 Method not allowed
Connection: close
Allow: OPTIONS, TRACE, GET, HEAD
...

, submit URL, URL. , , , URL- (.. ):

  • http://errorreporting.example.com/SubmitError.asp
  • http://errorreporting.example.com/SubmitError.aspx
  • http://errorreporting.example.com/SubmitError.ashx
  • http://errorreporting.example.com/ErrorReporting/Submit.ashx
  • http://errorreporting.example.com/submiterror.php
  • http://errorreporting.example.com/submit/submiterror.ashx

.

. URL, :

/* SErrorReportingUrl = 'http://www.example.com:8088/ErrorReporting/SubmitError.ashx';
   SErrorReportingUrl = 'http://www.example.com/ErrorReporting/SubmitError.ashx';
   SErrorReportingUrl = 'http://errorreporting.example.com:8088/ErrorReporting/SubmitError.ashx';
   SErrorReportingUrl = 'http://errorreporting.example.com/SubmitError.ashx';
   SErrorReportingUrl = 'http://errorreporting.example.com';
   SErrorReportingUrl = 'http://errorreporting.example.com/SubmitError.ashx'; 
*/
   SErrorReportingUrl = 'http://errorreporting.example.com/submit/SubmitError.ashx';

:

HTTP/1.1 200 OK
+3
1

, IIS POST .

XMLHttpRequest POST s. XMLHttpRequest (, Chrome, Internet Explorer, MSXML) , POST GET POST.

W3C XMLHttpReqest , :

HTTP:

(, ), , .

. HTTP body , , .

, XMLHttpRequest.


, IIS XMLHttpRequest, " " , 302 redirect, 200 OK > :

HTTP/1.1 200 OK
Connection: close
Date: Sun, 27 Jun 2010 13:28:14 GMT
Server: Microsoft-IIS/6.0
Location: http://errorreporting.example.com/submit/SubmitError.ashx
Content-Length: 92
Content-Type: text/html
Cache-control: private

<HTML><BODY>This content has moved <A href="submit/SubmitError.ashx">here.</A></BODY></HTML>

- .

+2

Source: https://habr.com/ru/post/1751794/


All Articles