Any URL that accepts HTTP POSTs should not render an HTML page. It should only perform an action on the web application, such as creating a new order, or updating a customer's record.
Displaying a page at the same time would only cause confusion for the web site's user. I really like this page, but it was displayed because I updated this customer from Chicago. What if I want to redisplay the same page later, will I need to update the customer one more?
And what about the dreaded message box when the refresh button is used: To display the webpage again, Internet Explorer needs to resend the information you've previously submitted. Retry, Cancel?
To avoid these issues, an HTTP POST should be responded to by a redirection inviting the browser to GET another URL. This gives the web site's user a clear address to return to should he like the page displayed as a result of his actions.
This implies that when we configure the routing for a given URL, we really should assign it only one of the HTTP verbs. Either the URL will accept HTTP GETs and display an HTML page, either it will accept HTTP POSTs and perform a redirection.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment