I have a web service that send a string as input parameter,do some functions on it and return a result. It works perfectly, when I debug it and call it inside a browser but when I call it from another application it returns the Error "The request failed with HTTP status 400: Bad Request ". As 400 errors are errors from client side I could not find out which is making this problem to me!!!
Asked
Active
Viewed 1,127 times
-2
-
It seems you have a problem with your code. However, we can't help unless we have [code or information that can reproduce the problem](//stackoverflow.com/help/mcve). Otherwise, we are just blindly guessing. – rene Dec 23 '17 at 08:44
-
Application that works is probably using a cookie. If you delete cookies from IE history manually the working code will stop working. To resolve issue I normally delete cookies and then capture with sniffer like wireshark or fiddler the IE that works. Then modify my c# application to look like working IE by adding missing headers. – jdweng Dec 23 '17 at 08:49
1 Answers
1
Finally I found the solution, As I told before Error 400 is a client side Error and my problem did not happen on Browsers but on calling from an application.
The problem was because of the string that I was sending to web service contains non-ASCII characters so It could not return the correct result. With the help of this post I removed non-ASCII characters and then send it to web service again and now it works perfectly.

Mohamad Saadat
- 21
- 6