Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple paths for ApiURIs-ISAPI-Integrated-4.0 in web.config

I am using ASP.NET MVC 4 and want to support dots in URLs. So I added the following configuration to web.config as other Q/A's suggested:

<system.webServer>
  <handlers>
    <add name="ApiURIs-ISAPI-Integrated-4.0"
     path="/user/*"
     verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
     type="System.Web.Handlers.TransferRequestHandler"
     preCondition="integratedMode,runtimeVersionv4.0" />
  </handlers>
</system.webServer>

Now I want to enable this for more than one paths, how can I do it?


Things I've tried:

Joining paths with comma or semicolon, not working, i.e.

path="/user/*,/event/*"

path="/user/*;/event/*"

If I add more <add> tags each for a path, I get an error saying 'Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'ApiURIs-ISAPI-Integrated-4.0'.

If I simply add '*' to the path, it causes problem with the script and css resolution, which I haven't figured out why. But before debugging into that I want to first find out if specifying multiple paths is possible.

like image 401
NS.X. Avatar asked Dec 12 '22 01:12

NS.X.


1 Answers

From my experiments it appears that the name attribute is simply a unique identifier, so can be any unique key. Try this:-

<system.webServer>
  <handlers>
    <add name="ApiURIs-ISAPI-Integrated-4.0_1"
     path="/user/*"
     verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
     type="System.Web.Handlers.TransferRequestHandler"
     preCondition="integratedMode,runtimeVersionv4.0" />
    <add name="ApiURIs-ISAPI-Integrated-4.0_2"
     path="/event/*"
     verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
     type="System.Web.Handlers.TransferRequestHandler"
     preCondition="integratedMode,runtimeVersionv4.0" />
  </handlers>
</system.webServer>
like image 173
Mr Slim Avatar answered Jan 04 '23 22:01

Mr Slim