Because most browsers only support HTTP GET and POST it would be useful to have a HttpHandler that can rewrite the HTTP method.
The HTTP method would be set with a hidden field:
<form method="POST" action="...">
<input type="hidden" name="_method" value="PUT">
...
</form>
If the user submits, a POST request is sent and an IHttpHandler should replace the requests HttpMethod, but it is a read-only property in .NET.
How can I rewrite the HTTP method in .NET?
In mvc (ver 2+) you can use the HtmlHelper.HttpMethodOverride helper, which creates a hidden input value with the required action method.
http://msdn.microsoft.com/en-us/library/ee402924.aspx
this creates this hidden input (for delete):
<input name="X-HTTP-Method-Override" type="hidden" value="DELETE" />some more info:
http://geekswithblogs.net/michelotti/archive/2010/01/08/implementing-a-delete-link-with-mvc-2-and-httpmethodoverride.aspx
UPDATE:
Looking a bit deeper into how this works in the MVC pipeline it’s actually MVC (ActionMethodSelectorAttribute, ActionInvoker,RedirectToRoute) that handles this and not the
RouteModule like I thought before.
You can look it up in the MVC source (from codeplex)… It’s quite strightforward. The more interesting parts are in HttpRequestBaseExtensions and HttpRequestExtensions