Question

I want to implement a routing system that admits a dot in the url. Currently I handle urls like:

mydomain/User/Details/raguilar

but if the username has a dot, then it is generated as:

mydomain/User/Details?username=r.aguilar

I tried to add the following route:

routes.MapRoute(
            name: "Users",
            url: "User/{action}/{username}",
            defaults: new { controller = "User", username = UrlParameter.Optional },
            constraints: new { username = @"\w+\.?\w+" }
        );

and all seems to be ok, but when I clicked on the url I received an error that says that the related resource is not found or something like that.

Is there some way to fix this issue?

Was it helpful?

Solution

In order to solve this problem I should add the following line to the system.webServer/handlers element:

<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" />

Where user is the controller to which belong the paths that will contain the dot.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top