Hi,

I am getting incorrect response from httpwebresponse. here, online, we got 
the message like

*"message": "messages": [ "We are sorry, the item you selected, cannot be 
done on-line." ] , "resultInfo": "result": "fail", "url": 
"http://www.abc.com/xyz/home";, "resultCode": 400 *
but using my code, i am getting this :-
 
*�  E��n�0 
D�| �Y�]�S��Y�t�� A E�TBe1�� i� �l��B� @��uCd ��`�t�� J%��T� r *,r�� ��;����# 
$xEo� 
 �B��(g ��]άt  ��� � 3 ���? ��` �C�7;G �1�k>�=�ʪ6' ��+ %�(���m;MS  
��x ZAV�ԥ@~��m� ���� ���O]7�on �;2  *
 
how to get the exect error message through code using C#?
 
*MyCode*
try
{
}
catch
{
                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);
                            }
                        }
                    }
                }
            }
}

-- 
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net

Reply via email to