Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExtensionlessUrlHandler and paths with dots

Extensionsless URLs (with ExtensionlessUrlHandler-Integrated-4.0) are working fine in my MVC 4 app, except for paths with dots in them, e.g.

/tags works fine

/tags/.net does not work

To make the second URL work I have to either set runAllManagedModulesForAllRequests="true" or remove the managedHandler precondition on the UrlRoutingModule-4.0 module and any other module that needs to run for that URL, which means I'm back to square one and all those modules will run for static requests (right?).

Is there a way to use the Extensionsless URLs with dots in the path?

like image 998
Max Toro Avatar asked Oct 21 '25 11:10

Max Toro


2 Answers

Change the path attribute to star, as in path="*"

like image 197
Geoffrey McGrath Avatar answered Oct 24 '25 13:10

Geoffrey McGrath


In my case when I added a copy of the handler with the specific extension that I wanted to be handled it worked fine:

<add name="ExtensionlessUrl-Integrated-4.0-webdav-xml" path="*.xml" verb="PUT" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" />

This handled a situation where I needed to allow file uploads to a WCF service using the PUT verb.

If you need to handle multiple extensions you could try setting the handler's path to * instead of *.

like image 32
Ciprian Teiosanu Avatar answered Oct 24 '25 13:10

Ciprian Teiosanu