I was starting a new ASP.NET MVC 5 project today, and like always was copy/pasting some code from a previous project. No need to reinvent anything if the work has been done... right?
In the web.config I saw the following under
<system.webServer> <handlers> ... <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> ... </handlers> </system.webServer>
Why would that even be there? Removing and adding again... There must be a point to this, right?
ExtensionlessUrlHandler-Integrated-4.0 handler only registers with a small set of verbs: GET, HEAD, POST, DEBUG. So you can't use PUT or DELETE with an extensionless url if you don't replace the handler. Something you would want to do with a RESTful Web API. The new handler registers for all verbs, and that includes PUT and DELETE.
There are a total of 3
ExtensionlessUrlHandlers. These are part of ASP.NET v4.0. On older machine's you have to install a KB/QFE to enable MVC (and WebForms?) to handle extensionless URLs, which wasn't possible in the previous version. See this link for more information.