I am creating a console application in C# to check if URL is up and running using HttpWebRequest.
Note that the URL is generated by IBM's ICN (IBM Content Navigator). It is NOT hosted using IIS.
I am receiving the below error while trying to get HttpWebResponse from my C# console application. Message: "The remote server returned an error: (500) Internal Server Error." Status: ProtocolError
Below code is not working:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(myurl);
request.Credentials = CredentialCache.DefaultCredentials;
request.Method = "GET";
request.Accept = "text/plain";
request.ContentType = "text/plain;charset=UTF-8";
request.Headers.Add("Accept-Language", "en-US");
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
if (response != null && response.StatusCode == HttpStatusCode.OK)
{
//Do some operations
}
else
{
//Do some operations
}
}
Please let me know if additional info. is required.
Any help or suggestions to solve this issue are appreciated.
Thanks in advance.