ASP.NET MVC Url Route supporting (dot) ASP.NET MVC Url Route supporting (dot) asp.net asp.net

ASP.NET MVC Url Route supporting (dot)


Add a UrlRoutingHandler to the web.config. This requires your url to be a bit more specific however (f.e. /Users/john.lee).This forces every url starting with /Users to be treated as a MVC url:

<system.webServer>      <handlers>          <add name="UrlRoutingHandler"          type="System.Web.Routing.UrlRoutingHandler,                System.Web, Version=4.0.0.0,                Culture=neutral,                PublicKeyToken=b03f5f7f11d50a3a"          path="/Users/*"          verb="GET"/>        </handlers></system.webServer>


Just add this section to Web.config, and all requests to the route/{*pathInfo} will be handled by the specified handler, even when there are dots in pathInfo. (taken from ServiceStack MVC Host Web.config example and this answer https://stackoverflow.com/a/12151501/801189)

This should work for both IIS 6 & 7. You could assign specific handlers to different paths after the 'route' by modifying path="*" in 'add' elements

  <location path="route">    <system.web>      <httpHandlers>        <add path="*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" />      </httpHandlers>    </system.web>    <!-- Required for IIS 7.0 -->    <system.webServer>      <modules runAllManagedModulesForAllRequests="true" />      <validation validateIntegratedModeConfiguration="false" />      <handlers>        <add name="ApiURIs-ISAPI-Integrated-4.0" path="*" type="System.Web.Handlers.TransferRequestHandler" verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" preCondition="integratedMode,runtimeVersionv4.0" />      </handlers>    </system.webServer>  </location>


I was facing the same issue. So the best solution for me is:

<system.webServer>    <modules runAllManagedModulesForAllRequests="true"></modules><system.webServer>