hello,
i have checked online on a website which gives error BadRequest(status code=400) and gives response like :
'"message": "messages": [ "We are sorry, the item you selected, cannot be done" ] , "resultInfo": "result": "fail", "url": "http://www.abc.com/xyz/pqr/home", "resultCode": 400'
but when i am doing the same thing at my code, i am receiving the same error BadRequest(status code=400) which is OK but i am receiving below response which is wrong:
En0 D|Y]SYtAETBe1ilB@uCdtJ%Tr*,r;#$xEo B(g]άt3?
C7;G1k>=ʪ6'+%(m;MS xZAVԥ@~mO]7on;2
How to Resolve this?
thanks,
try
{
//something
}
catch(WebException webException)
{
string strResponse = string.Empty;
Encoding Encding;
using (HttpWebResponse response = (HttpWebResponse)webException.Response)
{
if (response != null)
{
MemoryStream s = new MemoryStream();
using (var errorResponse = (HttpWebResponse)response)
{
using (var reader = new StreamReader(errorResponse.GetResponseStream()))
{
string error = reader.ReadToEnd();
Console.WriteLine(error);
}
}
}
}
}