je veux POST
des données de formulaire à la page par défaut d'un serveur Web, par exemple:IIS: 405 (Méthode non autorisée) lors de la publication par défaut la page
POST http://errorreporting.example.com/ HTTP/1.1
je veux que le serveur soit responsable de 302
rediriger le client à l'endroit où le POST
devrait aller. Le fichier default.asp
sur le serveur exécute cette tâche (which is the technique Microsoft recommends), en effectuant la Redirect
:
default.asp:
<%
Response.Redirect "SubmitError.ashx"
%>
Quand je simplement parcourir le serveur:
GET http://errorreporting.example.com/ HTTP/1.1
je reçois la réponse attendue du serveur:
HTTP/1.1 302 Object moved
Server: Microsoft-IIS/5.0
Location: SubmitError.ashx
...
Mais quand je POST
au serveur:
POST http://errorreporting.example.com/ HTTP/1.1
Le serveur devient très grincheux avec moi:
HTTP/1.1 405 Method not allowed
Connection: close
Allow: OPTIONS, TRACE, GET, HEAD
...
Je veux que le serveur pour pouvoir rediriger le client à la soumission appropriée URL
, plutôt que de coder en dur le client avec le URL. Ceci est, bien sûr, parce que l'URL pourrait (à savoir a) changé:
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
etc.
Remarque: Si je change le URL
pour inclure l'emplacement du document:
/* 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';
Il fonctionne très bien:
HTTP/1.1 200 OK