Unable to connect to remote server
-
Hi all... I am making a web request to a site & all is working fine. But today i found that the site url isnt working. Site is unavailable due to some reasons. So then in my code i am getting error of "Unable to connect to remote server". My code is as follows. private WebRequest _request; _request = WebRequest.Create(uri[j]); // uri[j] is an array containing site url _request.Method = "POST"; _request.ContentType = "application/x-www-form-urlencoded"; _request.ContentLength = buffer.Length; PostData = _request.GetRequestStream(); <---- gives error PostData.Write(buffer, 0, buffer.Length); How can i catch this exception? Is there some way to catch such exception??? Thnx in advance..
-
Hi all... I am making a web request to a site & all is working fine. But today i found that the site url isnt working. Site is unavailable due to some reasons. So then in my code i am getting error of "Unable to connect to remote server". My code is as follows. private WebRequest _request; _request = WebRequest.Create(uri[j]); // uri[j] is an array containing site url _request.Method = "POST"; _request.ContentType = "application/x-www-form-urlencoded"; _request.ContentLength = buffer.Length; PostData = _request.GetRequestStream(); <---- gives error PostData.Write(buffer, 0, buffer.Length); How can i catch this exception? Is there some way to catch such exception??? Thnx in advance..
This is plainly not an ASP.NET question. Have you tried putting this code in a try/catch block ?
Christian Graus Driven to the arms of OSX by Vista.
-
Hi all... I am making a web request to a site & all is working fine. But today i found that the site url isnt working. Site is unavailable due to some reasons. So then in my code i am getting error of "Unable to connect to remote server". My code is as follows. private WebRequest _request; _request = WebRequest.Create(uri[j]); // uri[j] is an array containing site url _request.Method = "POST"; _request.ContentType = "application/x-www-form-urlencoded"; _request.ContentLength = buffer.Length; PostData = _request.GetRequestStream(); <---- gives error PostData.Write(buffer, 0, buffer.Length); How can i catch this exception? Is there some way to catch such exception??? Thnx in advance..
Does your remote server working properly ? is it pinging ?
cheers, Abhijit