var response = string.Empty;
try
{
response = client.UploadString(webApiUrl, serialisedData);
}
catch (WebException ex)
{
if (ex.Response != null)
{
response = new StreamReader(ex.Response.GetResponseStream()).ReadToEnd();
}
}
If exception is found then we will get the response.