What will the below program do?
private static Tuple<bool,string> GetServerResponse(string fileLocation)
{
bool isValidURL = true;
string data = string.Empty;
using (WebClient client = new WebClient())
{
try
{
data = client.DownloadString(fileLocation);
}catch(WebException weX){
isValidURL = !isValidURL;
data = weX.Message;
}
}
return Tuple.Create<bool, string>(isValidURL, data);
}

 Posted by Rajnilari2015 on 1/25/2016 | Category: C# Interview questions | Views: 1281 | Points: 40
Select from following answers:
  1. If the URL is wrong or the file does not exist,it will return isValidURL false.
  2. If the URL is correct and the file exists at the proper URL,it will return isValidURL True.
  3. This program checks if a file Exists at a specified URI and if so, returns the file content
  4. The WebClient class Provides common methods for sending data to and receiving data from a resource identified by a URI.
  5. All Above

Show Correct Answer


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response