0

I am trying to pass data to a restful web service which receives data in JSON format. The data I am trying to GET is quite huge, I get an exception as shown below

request = WebRequest.Create(url) as HttpWebRequest;

The exception is

Invalid URI: The Uri string is too long.

Thanks in advance for the help.

Aron
  • 15,464
  • 3
  • 31
  • 64
  • and what's the value in `url`? It should be URI like `http://yoururl` – immayankmodi Sep 02 '14 at 03:39
  • url = @"http://remoteserver/service?data=jsondata" – user1058824 Sep 02 '14 at 03:43
  • You should use `POST` for large requests. – Aron Sep 02 '14 at 03:47
  • There is a limit on the number for characters that can be sent in a get request. If you have hosted the web service try to convert it into a post request. That will be better. – jsjunkie Sep 02 '14 at 03:48
  • I am afraid the service is hosted on a remote machine. I have no control over the web service. I can only consume the service. – user1058824 Sep 02 '14 at 03:52
  • Have you tried to check for json is valid or not? You can test it http://jsonlint.com/ here. If it's valid then you should check the length of the json data because i guess it may exceed the default length and causing this error. – immayankmodi Sep 02 '14 at 04:32

0 Answers0