我想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