When I am going to add some website like http://www.nirmauni.ac.in/
, then it says the above mentioned error. So, how to fix this problem?
I have given my code. Just go through and say where the change should be made.
bool IsLinkWorking(string url)
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
//You can set some parameters in the "request" object...
request.AllowAutoRedirect = true;
ServicePointManager.ServerCertificateValidationCallback = (s, cert, chain, ssl) => true;
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
return true;
}
catch
{
//TODO: Check for the right exception here
return false;
}
}
From Your Error It seems that you are creating a web request with wrong url.
Please make sure that in (HttpWebRequest)HttpWebRequest.Create(url);
url string must start with proper protocol like (http,https etc.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With