User-719153870 posted
Hi kortmazsefa,
The remote server returned an error: (500) Internal Server Error
This is most likely caused by error in your httpWebRequest.
Please try :
HttpWebResponse httpResponse;
try
{
httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
}
catch (WebException ex)
{
httpResponse = (HttpWebResponse)ex.Response;
}
insead of :
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
In this case, when an exception occurs, not only does StatusCode mark the error code of HTTP in WebException, but its Response attribute also contains the WebResponse sent by the server to indicate the actual HTTP error encountered.
You can also refer to here for more details.
Best Regard,
Yang Shen