0

I am getting exception(The remote server returned an error: (500) Internal Server Error.) for request.GetResponse() if I deploy application in different port other than 80(default), when I try to access the URL , it is working fine.

I had followed many suggestions from "Stackoverflow" and google. still I am getting the error with the below code

private bool Ping(string url, out string message)
    {
        message = string.Empty;
        try
        {
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
            request.Credentials = CredentialCache.DefaultCredentials;
            request.Timeout = 3000;
            request.AllowAutoRedirect = false; 
            request.Method = "HEAD"; 
            using (WebResponse response = request.GetResponse())
            {
                return true;
            }
        }
        catch (Exception ex)
        {
            message = ex.Message;
        }
        return false;
    }

Thanks,

Pavan

Pavan Kumar kota
  • 45
  • 1
  • 1
  • 9

1 Answers1

0

This is usually an issue on the server side and should have nothing to do with your application.

That said, have you tried to access the same url from your computer / device (via chrome or IE) with the other port?

If it works on other devices, then you should check your device's setup; but I still think it's an issue on the server.

Barnstokkr
  • 2,904
  • 1
  • 19
  • 34