07-22-2023, 11:24 PM
I'm trying to get the following (and similar) urls to work in my ASP.net MVC4/WebApi project:
The route responsible for this url looks like this:
config.Routes.MapHttpRoute(
name: "Nav",
routeTemplate: "api/nav/{project}/{assembly}/{namespace}/{type}/{member}",
defaults: new { controller = "Nav", assembly = RouteParameter.Optional, @namespace = RouteParameter.Optional, type = RouteParameter.Optional, member = RouteParameter.Optional }
);
It works just fine if I remove the . in the file-name, or if I add a slash behind the URL, but that also means I can't use the `Url.Route`-methods etc. The error I get is a generic 404-error (image below).
![enter image description here][1]
I've tried adding `<httpRuntime targetFramework="4.5" relaxedUrlToFileSystemMapping="true" />` to my web.config, and I've also tried adding
<compilation debug="true" targetFramework="4.5">
<buildProviders>
<remove extension=".dll"/>
<remove extension=".exe"/>
</buildProviders>
</compilation>
And none of it seems to work. So my question is basically, how can I get this URL to work, and map correctly?
[1]:
[To see links please register here]
The route responsible for this url looks like this:
config.Routes.MapHttpRoute(
name: "Nav",
routeTemplate: "api/nav/{project}/{assembly}/{namespace}/{type}/{member}",
defaults: new { controller = "Nav", assembly = RouteParameter.Optional, @namespace = RouteParameter.Optional, type = RouteParameter.Optional, member = RouteParameter.Optional }
);
It works just fine if I remove the . in the file-name, or if I add a slash behind the URL, but that also means I can't use the `Url.Route`-methods etc. The error I get is a generic 404-error (image below).
![enter image description here][1]
I've tried adding `<httpRuntime targetFramework="4.5" relaxedUrlToFileSystemMapping="true" />` to my web.config, and I've also tried adding
<compilation debug="true" targetFramework="4.5">
<buildProviders>
<remove extension=".dll"/>
<remove extension=".exe"/>
</buildProviders>
</compilation>
And none of it seems to work. So my question is basically, how can I get this URL to work, and map correctly?
[1]: