我想POST表单数据到网络服务器的默认页面,当如:IIS:405(方法不允许)发布默认页
POST http://errorreporting.example.com/ HTTP/1.1
我希望服务器负责302将客户重定向到POST应该去的地方。该default.asp文件的服务器上执行此任务(which is the technique Microsoft recommends),通过执行Redirect:
的default.asp:
Response.Redirect "SubmitError.ashx"
%>
当我只是浏览服务器:
GET http://errorreporting.example.com/ HTTP/1.1
我收到服务器的预期响应:
HTTP/1.1 302 Object moved
Server: Microsoft-IIS/5.0
Location: SubmitError.ashx
...
但是,当我POST到服务器:
POST http://errorreporting.example.com/ HTTP/1.1
服务器变得非常暴躁跟我说:
HTTP/1.1 405 Method not allowed
Connection: close
Allow: OPTIONS, TRACE, GET, HEAD
...
我想服务器能够重定向客户到相应的提交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
2010-06-25
Ian Boyd