Reputation: 9503
My Route looks like:
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}/{uri}",
defaults: new { id = RouteParameter.Optional, uri = RouterParameter.Optional }
);
I have a Base64 encoded uri that I send in place of the {uri} parameter. It has no illegal characters (I've formatted it properly and checked to make sure). However, it's about 300-400 characters long.
When I send a DELETE request to this address using the long base64 parameter, I get a 400 BAD STATUS, INVALID URL response. When shortening the parameter, it works. I suspect that there is a max path problem?
Using a query string in place of a path parameter works, but I'd rather stay with the RESTful approach. Is there a config setting I can change on my Web API project to allow longer path-based parameters?
This works:
http://localhost:99999/api/reg/10?uri=<long_base64_parameter>
This does not work:
http://localhost:99999/api/reg/10/<long_base64_parameter>
Upvotes: 3
Views: 4792
Reputation: 7141
Looks like these are related:
The request URL is invalid in IIS 7
ASP.NET MVC, Url Routing: Maximum Path (URL) Length
Also see:
http://social.msdn.microsoft.com/Forums/nl/netfxnetcom/thread/723e6bfd-cab7-417b-b487-67f1dcfa524f
Looks like there might be path segment restrictions by default, but there are several workarounds (url rewriting, registry changes, etc.)
Upvotes: 1