if (IsURLValid(url))
{
Uri requestUri = new Uri(url);
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUri);
httpWebRequest.Proxy = WebRequest.GetSystemWebProxy();
httpWebRequest.Timeout = 3000;
httpWebRequest.Method = "HEAD";
//httpWebRequest.AllowAutoRedirect = true;
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0";
httpWebRequest.Accept = "*/*";
httpWebRequest.ServicePoint.Expect100Continue = false;
httpWebRequest.AllowAutoRedirect = true;
httpWebRequest.MaximumAutomaticRedirections = 4;
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
httpWebResponse.Close();
MessageBox.Show(httpWebResponse.ResponseUri.ToString());
if ((httpWebResponse.StatusCode == HttpStatusCode.OK) || (httpWebResponse.StatusCode == HttpStatusCode.Redirect))
{
return true;
}
else
{
return false;
}
}
return false;
}
catch (WebException)
{
return false;
}
}
The above code is working good however its giving some false results. The below url is live however the result we are getting is invalid.
https://forum.unity.com/threads/clean-way-to-talk-to-external-application-c-to-ros-c-node.418849/
I have tried online checker also, those checkers also giving same error. https://httpstatus.io/ check the unity url in httpstatus its giving error. ANy one have idea why it is like that?