4

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?

Max Toro
  • 28,282
  • 11
  • 76
  • 114

3 Answers3

2

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

Geoffrey McGrath
  • 1,663
  • 1
  • 14
  • 35
  • 1
    Unfortunately, this solution appears to cause [another problem](https://stackoverflow.com/questions/60865362/asp-net-returns-http-500-instead-of-404). – O. R. Mapper Mar 31 '20 at 08:53
1

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 *.

Ciprian Teiosanu
  • 1,553
  • 16
  • 19
  • 1
    "try setting the handler's path to `*` instead of `*.`" - unfortunately, this appears to cause [another problem](https://stackoverflow.com/questions/60865362/asp-net-returns-http-500-instead-of-404). – O. R. Mapper Apr 23 '20 at 07:20
0

Change the path attribute from "." to "/"

Scope Creep
  • 811
  • 7
  • 14