c# - Restful post throws 400 invalid url when reaching 295 chars -


I have created a cool webservice with the web API.

I have a post on this URL

  ../ API / AAEAAAD _____ AQAAAAAAAAAMAgAAAEVPYmplY3RUb0Jhc2U2NCwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwFAQAAABlPYmplY3RUb0Jhc2U2NC5DcmVkZW50aWFsAgAAABk8VXNlcm5hbWU-a19fQmFja2luZ0ZpZWxkGTxQYXNRmllbGQBAQIAAAAGAwAAAA5hd2NhQGF0ZWEtYW5jdAYEAAAAC0czcnRtNG5zMGZ0CwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2 / say  

base 64

is encoded
  HttpServerUtility.UrlTokenEncode ();  

I get a "HTTP Error 400. The request URL is invalid." When someone is trying to post

I tried to set up maxUrlLength , as I have seen some other people with the same problem, sorry, it does not help.

I have tried so far

  • Changing maxUrlLength in web.config
  • Setting UrlSegmentMaxLength in Registry

Something is not working yet. I have got the magic number 294 in full url - that is, if I bite with a long strings from some stars, unless I can not find 294 characters, everything works just as it is Why is not there a routing problem or a problem with my post method?

Any good idea what could be the problem?

Whatever I'm trying to do,

  config.routes.MapHttpRoute (name: "DefaultApi", MargTemplate: "API / {key} / {controller} / { Id} ", default: new {key = RouteParameter.Optional, ID = RootParameter. Optional});  

and my post method

  public string post (string key) {if (ConvertFromBase64 (key)) {// Do stuff}}   

Instead of trying with the key in the query string? Public Class SomeController: Controller [Route ("API / Say")] Public Actionsal Salute (String Key) {}

A URL like

  K/apiai/se?ke=aaaad_____akaaaaamgaavpymply3RUb0Jhc2U2NCwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFBlYmxpY0tleVRva2VuPW5lbGwFAQAAABlPYmplY3RUb0Jhc2U2NC5DcmVkZW50aWFsAgAAABk8VXNlcm5hbWU-al9fQmFja2luZ0ZpZWxkGTxQYXNRmllbGQBAQIAAAAGAwAAAA5hd2NhQGF0ZWEtYW5jdAYEAAAAC0czcnRtNG5zMGZ0CwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -