I've created a restful webservice with Web-Api.
I'm trying to do a post at this url
../api/AAEAAAD_____AQAAAAAAAAAMAgAAAEVPYmplY3RUb0Jhc2U2NCwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwFAQAAABlPYmplY3RUb0Jhc2U2NC5DcmVkZW50aWFsAgAAABk8VXNlcm5hbWU-a19fQmFja2luZ0ZpZWxkGTxQYXNRmllbGQBAQIAAAAGAwAAAA5hd2NhQGF0ZWEtYW5jdAYEAAAAC0czcnRtNG5zMGZ0CwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2/say
The base64 is encoded with
HttpServerUtility.UrlTokenEncode();
I get a "HTTP Error 400. The request URL is invalid."
when trying to do a post.
I've tried setting maxUrlLength
as I've seen a few others with the same type of problem, alas, this did not help.
So far, I've tried
- changing maxUrlLength in web.config.
- Setting UrlSegmentMaxLength in Registry
nothing has worked so far. I've found the magic number to be 294 allowed chars in the full url meaning -> If I cut of some of the characters from the long string until i get to 294 characters, everything works as intented, as to why certain it's not a routing problem nor a problem with my post method
Any good ideas as to what can be the issue?
For anyone trying to achieve the same thing I'm trying - Heres my route
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{key}/{controller}/{id}",
defaults: new { key=RouteParameter.Optional,id = RouteParameter.Optional }
);
and my Post method
public string Post(string key)
{
if(ConvertFromBase64(key))
{
//Do stuff
}
}