The code below is what I use for posting an xml file to the remote server. It works fine. However, there are times when I just want to test if the server is down without actually sending any file. How can I do that?
Code:
public void PostResponse(String fileName, String uploadUrl)
{
ASCIIEncoding oEncoder = new ASCIIEncoding();
byte[] bytArray = oEncoder.GetBytes(fileName);
try
{
WebClient myWebClient = new WebClient();
Byte[] responseArray = myWebClient.UploadData (uploadUrl, "POST", bytArray);
}
catch (Exception ex)
{
throw ex;
}
return;
}